Committing work for creating docker images of Web and API apps

Outstanding work include:
- Adding CI/CD workflow compatible with Woodpecker CI
- Figure out how to load runtime environment variables onto the API docker build process
This commit is contained in:
2024-03-19 20:56:56 -05:00
parent 0ca2a0e38c
commit f1144d2cb9
10 changed files with 17465 additions and 4847 deletions

View File

@ -1,13 +1,28 @@
# https://www.knowledgehut.com/blog/web-development/how-to-dockerize-react-app
FROM node:17-alpine as builder
WORKDIR /app
COPY package-lock.json .
RUN npm install
COPY . .
RUN npm build
FROM nginx:latest
# Set the environment variables
ENV API_BASE_URL=
ENV AUTH0_DOMAIN=
ENV AUTH0_CLIENT_ID=
ENV AUTH0_CALLBACK_URL=
ENV AUTH0_AUDIENCE=
WORKDIR /app
COPY package.json .
RUN npm install
RUN echo 'DEBUG': $API_BASE_URL
RUN echo 'DEBUG': $AUTH0_DOMAIN
RUN echo 'DEBUG': $AUTH0_CLIENT_ID
RUN echo 'DEBUG': $AUTH0_CALLBACK_URL
RUN echo 'DEBUG': $AUTH0_AUDIENCE
COPY . .
RUN npm run build
FROM nginx:mainline-alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/build .
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]