diff --git a/Dockerfile b/Dockerfile index ae25cf7..97443ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/create-env-file.sh b/create-env-file.sh new file mode 100644 index 0000000..f29fa80 --- /dev/null +++ b/create-env-file.sh @@ -0,0 +1,6 @@ +touch .env + +for envvar in "$@" +do + echo "$envvar" >> .env +done \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4f099fd --- /dev/null +++ b/docker-compose.yml @@ -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/ \ No newline at end of file