-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- containerizes app.
- Loading branch information
Mango Habanero
committed
Apr 4, 2023
1 parent
8d8c4d9
commit 6d5a141
Showing
3 changed files
with
74 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 @@ | ||
Dockerfile | ||
node_modules | ||
npm-debug.log | ||
.DS_Store | ||
dist |
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,10 @@ | ||
# base image | ||
FROM node:18-alpine as build | ||
WORKDIR /usr/src/app | ||
COPY package*.json ./ | ||
RUN npm ci --omit=optional | ||
COPY . . | ||
RUN npm run build | ||
EXPOSE 9000 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
version: '3.9' | ||
|
||
networks: | ||
default: | ||
external: true | ||
name: cic | ||
|
||
services: | ||
postgres: | ||
image: postgres:14-alpine | ||
restart: unless-stopped | ||
user: postgres | ||
environment: | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_DB=cic_ussd | ||
volumes: | ||
- cic-ussd-pg:/var/lib/postgresql/data | ||
- ./init_db.sql:/docker-entrypoint-initdb.d/init_db.sql | ||
ports: | ||
- '5432:5432' | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
redis: | ||
image: redis:6-alpine | ||
restart: unless-stopped | ||
volumes: | ||
- cic-ussd-redis:/data | ||
ports: | ||
- '6379:6379' | ||
healthcheck: | ||
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
cic-ussd: | ||
image: cic-ussd:latest | ||
env_file: | ||
- .env | ||
restart: unless-stopped | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
redis: | ||
condition: service_healthy | ||
environment: | ||
- POSTGRES_URL=postgres://postgres:postgres@postgres:5432/cic_ussd | ||
- REDIS_URL=redis://redis:6379 | ||
- NODE_ENV=development | ||
command: npm run start | ||
|
||
volumes: | ||
cic-ussd-pg: | ||
driver: local | ||
cic-ussd-redis: | ||
driver: local |