Skip to content

Commit

Permalink
[Upd] Update docker entrypoint configuration and environment variable…
Browse files Browse the repository at this point in the history
…s are now set at runtime
  • Loading branch information
LaChope committed May 10, 2022
1 parent 7426ee4 commit e1ffc64
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .docker/config.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Dynamic configuration
window.__config__ = {
APP_DOMAIN: '${API_DOMAIN}',
APP_TITLE: '${APP_TITLE}',
LANGUAGE: '${LANGUAGE}',
NAVIGATOR_LANGUAGE: '${NAVIGATOR_LANGUAGE}'
}
File renamed without changes.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
APP_TITLE=Plan Manager
APP_DOMAIN=https://localhost:3000/plan-manager/
LANGUAGE: 'en',
NAVIGATOR_LANGUAGE: 'en'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea
.idea

.env
24 changes: 16 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# BASE STAGE
# Prepare node, copy package.json
FROM node:16-alpine AS base

ARG REACT_APP_ENDPOINT

WORKDIR /usr/src/app
COPY package.json package-lock.json ./
COPY create-env-file.sh ./create-env-file.sh

# DEPENDENCIES STAGE
# Install production and dev dependencies
Expand All @@ -15,8 +11,6 @@ FROM base AS dependencies
#RUN npm set progress=false && npm config set depth 0
RUN npm install

RUN sh create-env-file.sh REACT_APP_ENDPOINT=$REACT_APP_ENDPOINT

# BUILD STAGE
# run NPM build
FROM dependencies as build
Expand All @@ -28,5 +22,19 @@ RUN set -ex; \

# RELEASE STAGE
# Only include the static files in the final image
FROM nginx
COPY --from=build /usr/src/app/build /usr/share/nginx/html
FROM nginx:1.17.0-alpine

# Copy the react build from Build Stage
COPY --from=build /usr/src/app/build /var/www

# Copy our custom nginx config
COPY .docker/config.js.template /etc/nginx/config.js.template

COPY --from=build /usr/src/app/build /usr/share/nginx/html

# from the outside.
EXPOSE 80

COPY .docker/docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
8 changes: 0 additions & 8 deletions docker-compose.yml

This file was deleted.

0 comments on commit e1ffc64

Please sign in to comment.