-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from xenosf/docker-compose-env
Centralize env config
- Loading branch information
Showing
7 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
################## | ||
# BACKEND CONFIG # | ||
################## | ||
|
||
# !NOTE: This is a template. Make a copy named .env and fill in the relevant fields. | ||
|
||
# COMMON | ||
# --------------- | ||
ENV=PROD | ||
|
||
|
||
# USER SERVICE | ||
# --------------- | ||
PORT_USER=3001 | ||
# MongoDB | ||
DB_URI_USER='' | ||
# JWT secret | ||
JWT_SECRET=you-can-replace-this-with-your-own-secret | ||
|
||
|
||
# QUESTION SERVICE | ||
# --------------- | ||
PORT_QUESTION=3002 | ||
# MongoDB | ||
DB_URI_QUESTION='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
services: | ||
user: | ||
build: ./user-service | ||
build: | ||
context: ./user-service | ||
dockerfile: Dockerfile | ||
args: | ||
- PORT=${PORT_USER} | ||
ports: | ||
- 3001:3001 | ||
- ${PORT_USER}:${PORT_USER} | ||
environment: | ||
- ENV | ||
- DB_CLOUD_URI=${DB_URI_USER} | ||
- DB_LOCAL_URI=${DB_URI_USER} | ||
- JWT_SECRET | ||
|
||
questions: | ||
build: ./question-service | ||
build: | ||
context: ./question-service | ||
dockerfile: Dockerfile | ||
args: | ||
- PORT=${PORT_QUESTION} | ||
ports: | ||
- 3002:3002 | ||
- ${PORT_QUESTION}:${PORT_QUESTION} | ||
environment: | ||
- ENV | ||
- DB_CLOUD_URI=${DB_URI_QUESTION} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM node:18-alpine | ||
ARG PORT | ||
ENV PORT=$PORT | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm install --omit=dev | ||
CMD ["npm", "start"] | ||
EXPOSE 3002 | ||
EXPOSE $PORT |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM node:18-alpine | ||
ARG PORT | ||
ENV PORT=$PORT | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm install --omit=dev | ||
CMD ["npm", "start"] | ||
EXPOSE 3001 | ||
EXPOSE $PORT |