-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f99cfdd
commit 80f6655
Showing
1 changed file
with
24 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
# Base image for building the application | ||
# base image | ||
FROM node:14.17.0-alpine as build-stage | ||
|
||
COPY ./package*.json ./ | ||
# Install dependencies | ||
RUN npm install --unsafe-perm --dev | ||
COPY . ./ | ||
# set working directory | ||
WORKDIR /case-flow-web/app | ||
|
||
# Build the application | ||
RUN npm run build | ||
# add `/app/node_modules/.bin` to $PATH | ||
ENV PATH /case-flow-web/app/node_modules/.bin:$PATH | ||
|
||
# Intermediate stage for serving the built application | ||
FROM artifacts.developer.gov.bc.ca/redhat-access-docker-remote/ubi8/nginx-122 AS deployer | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh | ||
|
||
USER default | ||
# install and cache app dependencies | ||
COPY package-lock.json /case-flow-web/app/package-lock.json | ||
COPY package.json /case-flow-web/app/package.json | ||
|
||
RUN npm install --unsafe-perm --dev | ||
#RUN npm install [email protected] -g --silent | ||
|
||
COPY . /case-flow-web/app/ | ||
|
||
RUN npm run build | ||
|
||
RUN ls -lrt | ||
FROM nginx:latest as production-stage | ||
|
||
# Copy the built files from the previous stage to Nginx's HTML directory | ||
COPY --from=build-stage ./build /usr/share/nginx/html | ||
# Fix permissions for Nginx directories | ||
RUN mkdir -p /var/cache/nginx/client_temp && \ | ||
chmod 755 /var/cache/nginx && \ | ||
chmod 700 /var/cache/nginx/client_temp && \ | ||
chown nginx:nginx /var/cache/nginx/client_temp | ||
|
||
# Copy Nginx configuration file from the host | ||
COPY --from=build-stage /case-flow-web/app/build /usr/share/nginx/html | ||
COPY ./nginx_conf/nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Command to start Nginx when the container starts | ||
CMD ["nginx", "-g", "daemon off;"] |