Skip to content

Commit

Permalink
feat(docker): Dockerizes app
Browse files Browse the repository at this point in the history
- containerizes app.
  • Loading branch information
Mango Habanero committed Apr 4, 2023
1 parent 8d8c4d9 commit 6d5a141
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Dockerfile
node_modules
npm-debug.log
.DS_Store
dist
10 changes: 10 additions & 0 deletions Dockerfile
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"]

59 changes: 59 additions & 0 deletions dev/docker-compose.yaml
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

0 comments on commit 6d5a141

Please sign in to comment.