Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
node_modules
npm-debug.log
.git
.git
docker-compose*
.dockerignore
.gitignore
Dockerfile
8 changes: 0 additions & 8 deletions .env

This file was deleted.

8 changes: 0 additions & 8 deletions .env.example

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
.env
docker-compose.override.yml
src/config/.env.development
config.ts
config.ts
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ FROM node:18-alpine

WORKDIR /usr/src/app

COPY ["package.json", "package-lock.json", "tsconfig.json", ".env", "./"]

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]
CMD ["./start.sh"]
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ Create .env file in format of the .env.example
run "npm install"

# Run on docker
docker-compose up --build -d

`cp docker-compose.override.yml.example docker-compose.override.yml`

Then modify your local copy of `docker-compose.override.yml` to suit your local testing environment.

`docker-compose up --build -d`

Then you can run the following to boot the container stack and view its console to follow logs and debug.

`docker-compose up -d && docker-compose logs -f`
30 changes: 30 additions & 0 deletions docker-compose.override.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3.9"

x-environment: &environment
environment:
SERVICE_PORT: 3000
# Database connection
DB_USER: 'postgres'
DB_URL: 'postgres'
DB_NAME: 'postgres'
DB_PASSWORD: 'postgres'
DB_ROOT_PASSWORD: 'postgres'
DB_PORT: 5432
POSTGRES_PASSWORD: 'postgres'
services:
api:
ports:
- 3000:3000
volumes:
- .:/usr/src/app
<<: *environment

postgres:
ports:
- "5432:5432"
volumes:
- data:/var/lib/postgresql/data
<<: *environment

volumes:
data: {}
25 changes: 4 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
version: "3.8"
version: "3.9"
services:
api:
container_name: api-gateway
restart: always
build: .
ports:
- ${SERVICE_PORT}:${SERVICE_PORT}
image: pulldating/apigateway:latest
depends_on:
- db
volumes:
- .:/usr/src/app

db:
container_name: postgres
image: postgres
ports:
- "4321:${DB_PORT}"
volumes:
- data:/data/db
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
- POSTGRES_DB=${DB_NAME}

volumes:
data: {}
postgres:
image: postgres:latest
3 changes: 3 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
npm install
npm start