react-project/client/Dockerfile
2024-02-28 12:42:50 +02:00

42 lines
917 B
Docker

ARG NGINX_IMAGE="nginx"
ARG NGINX_VERSION="alpine"
ARG NODE_IMAGE="node"
ARG NODE_VERSION="16.17.1-alpine"
## Builder image (builds the static content from JS sources)
FROM ${NODE_IMAGE}:${NODE_VERSION} AS appbuild
WORKDIR /app
COPY package.json package-lock.json /app/
RUN npm ci --no-audit --no-fund \
&& ls -la /app \
&& find /app ! -path '/app/node_modules/*'
COPY . /app/
RUN npm ci \
&& npm run build \
&& ls -la /app \
&& find /app ! -path '/app/node_modules/*'
## Client web server image
FROM ${NGINX_IMAGE}:${NGINX_VERSION}
COPY --from=appbuild app/build/ /usr/share/nginx/html/
# Copy the custom Nginx configuration
COPY default.conf /etc/nginx/conf.d/default.conf
RUN ls -la /usr/share/nginx/html/ \
&& chown root:root -R /usr/share/nginx/html/ \
&& chmod 755 -R /usr/share/nginx/html/ \
&& ls -la /usr/share/nginx/html/ \
&& find /usr/share/nginx/html/