2024-02-04 15:10:32 +08:00
|
|
|
FROM node:18.12.1-buster-slim AS builder
|
|
|
|
|
|
|
|
# Set the working directory in the container
|
|
|
|
WORKDIR /app
|
|
|
|
|
2024-04-06 17:47:01 +08:00
|
|
|
ARG VERSION="6.0.1"
|
2024-02-04 15:10:32 +08:00
|
|
|
|
2024-04-06 17:47:01 +08:00
|
|
|
# Install dependencies
|
2024-02-04 15:10:32 +08:00
|
|
|
RUN mkdir webapp && npm pack @wisemapping/webapp@${VERSION} && tar -xvzf wisemapping-webapp-${VERSION}.tgz -C webapp
|
|
|
|
|
|
|
|
# Use Nginx as the production server
|
2024-02-05 00:45:00 +08:00
|
|
|
FROM nginx:latest
|
2024-02-04 15:10:32 +08:00
|
|
|
LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>"
|
|
|
|
|
|
|
|
## Copy the built React app to Nginx's web server directory
|
2024-04-06 17:47:01 +08:00
|
|
|
COPY --from=builder /app/webapp/package/dist/* /usr/share/nginx/html/
|
2024-02-04 15:10:32 +08:00
|
|
|
|
2024-02-05 00:45:00 +08:00
|
|
|
ADD nginx.conf .
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
2024-02-04 15:10:32 +08:00
|
|
|
# Expose port 80 for the Nginx server
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
# Start Nginx when the container runs
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|