Skip to content

Commit

Permalink
[New] Add react environment variable for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed May 10, 2022
1 parent 4bfdf62 commit 7426ee4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 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 @@ -11,6 +15,8 @@ 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 Down
6 changes: 6 additions & 0 deletions create-env-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
touch .env

for envvar in "$@"
do
echo "$envvar" >> .env
done
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3"
services:
plan-manager:
container_name: plan-manager
build:
context: .
args:
- REACT_APP_ENDPOINT=https://kbss.felk.cvut.cz/csat/plan-manager/

0 comments on commit 7426ee4

Please sign in to comment.