-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): implement Docker for project
- Include Docker file to build image for project and containerize the project - Configure Docker compose for easy setup
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 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,5 @@ | ||
node_modules | ||
npm-debug.log | ||
Dockerfile | ||
docker-compose.yml | ||
.dockerignore |
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,13 @@ | ||
FROM node:20-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json . | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE $PORT | ||
|
||
CMD ["npm", "run", "dev"] |
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,15 @@ | ||
FROM node:20-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json . | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
EXPOSE $PORT | ||
|
||
CMD ["npm", "start"] |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgresdb: | ||
image: postgres | ||
environment: | ||
POSTGRES_USER: $PDN_DB_USER | ||
POSTGRES_PASSWORD: $PDN_DB_PASS | ||
POSTGRES_DB: $PDN_DB_NAME | ||
volumes: | ||
- knights-data:/var/lib/postgresql/data | ||
|
||
node-prod-app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.prod | ||
env_file: | ||
- ./.env | ||
ports: | ||
- $PORT:$PORT | ||
depends_on: | ||
- postgresdb | ||
|
||
volumes: | ||
knights-data: |
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,27 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgresdb: | ||
image: postgres | ||
environment: | ||
POSTGRES_USER: $DEV_DB_USER | ||
POSTGRES_PASSWORD: $DEV_DB_PASS | ||
POSTGRES_DB: $DEV_DB_NAME | ||
volumes: | ||
- knights-data:/var/lib/postgresql/data | ||
|
||
node-app: | ||
build: . | ||
volumes: | ||
- .:/app | ||
- /app/node_modules | ||
image: knights-app:1.0 | ||
env_file: | ||
- ./.env | ||
ports: | ||
- $PORT:$PORT | ||
depends_on: | ||
- postgresdb | ||
|
||
volumes: | ||
knights-data: |