Skip to content

Commit 853a625

Browse files
committed
Add docker files
1 parent 237d2d5 commit 853a625

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/ticketing?schema=public"
2+
BACKEND_PORT=3300
3+
POSTGRES_USER=postgres
4+
POSTGRES_PASSWORD=postgres
5+
POSTGRES_DB=ticketing
6+
POSTGRES_PORT=5432

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:22-alpine
2+
3+
RUN apk update && apk upgrade && apk add bash
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install
10+
11+
RUN npm run build
12+
13+
CMD npm run start:prod

docker-compose.dev.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: ticketing-dev-db
2+
3+
services:
4+
postgres:
5+
image: postgres:latest
6+
restart: always
7+
environment:
8+
POSTGRES_USER: ${POSTGRES_USER}
9+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
10+
POSTGRES_DB: ${POSTGRES_DB}
11+
ports:
12+
- '${POSTGRES_PORT}:5432'
13+
volumes:
14+
- postgres_data:/var/lib/postgresql/data
15+
16+
volumes:
17+
postgres_data: {}

docker-compose.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: ticketing-api
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
ports:
8+
- "${BACKEND_PORT}:${BACKEND_PORT}"
9+
env_file:
10+
- .env
11+
restart: always
12+
networks:
13+
- ticketing-network
14+
depends_on:
15+
- db
16+
17+
db:
18+
image: postgres:latest
19+
env_file:
20+
- .env
21+
restart: always
22+
volumes:
23+
- ticketing_db_folder:/var/lib/postgresql/data
24+
networks:
25+
- ticketing-network
26+
27+
volumes:
28+
ticketing_db_folder:
29+
30+
networks:
31+
ticketing-network:

0 commit comments

Comments
 (0)