diff --git a/Dockerfile b/Dockerfile.backend similarity index 100% rename from Dockerfile rename to Dockerfile.backend diff --git a/Dockerfile.frontend b/Dockerfile.frontend new file mode 100644 index 0000000..2dbb372 --- /dev/null +++ b/Dockerfile.frontend @@ -0,0 +1,12 @@ +FROM node:latest as build-stage +WORKDIR /app +COPY ./web/package*.json ./ +COPY ./.env ./ +RUN npm ci +COPY ./web/ . +RUN npm run build + +FROM nginx as production-stage +RUN mkdir /app +COPY --from=build-stage /app/dist /app +COPY ./web/nginx.conf /etc/nginx/nginx.conf diff --git a/README.MD b/README.MD index cd79315..25abb7b 100644 --- a/README.MD +++ b/README.MD @@ -12,6 +12,8 @@ ### For website - API_ADDRESS +- FRONT_PORT +- FRONT_BASE_PATH ## Usage diff --git a/docker-compose.yml b/docker-compose.yml index ad8c7f9..da4f958 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,9 @@ services: timeout: 30s retries: 10 backend: - build: . + build: + context: ./ + dockerfile: ./Dockerfile.backend image: parismuseesquizz-backend depends_on: db: @@ -29,6 +31,18 @@ services: - back-net ports: - "${API_PORT}:${API_PORT}" + frontend: + build: + context: ./ + dockerfile: ./Dockerfile.frontend + image: parismuseesquizz-frontend + env_file: + - .env + ports: + - "${FRONT_PORT}:80" + networks: + - front-net networks: back-net: + front-net: diff --git a/web/index.html b/web/index.html index d96e085..b3636c3 100644 --- a/web/index.html +++ b/web/index.html @@ -4,7 +4,7 @@ -