Skip to content

Commit da6c6e0

Browse files
Setup Docker
1 parent c8d9143 commit da6c6e0

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.19-alpine
2+
3+
RUN mkdir /app
4+
5+
ADD . /app
6+
7+
WORKDIR /app
8+
9+
RUN go build -o main cmd/main.go
10+
11+
CMD ["/app/main"]

docker-compose.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: "3.8"
2+
3+
services:
4+
web:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
image: app
9+
container_name: app
10+
restart: unless-stopped
11+
env_file: .env
12+
ports:
13+
- "$PORT:$PORT"
14+
depends_on:
15+
- mongodb
16+
17+
mongodb:
18+
image: mongo:6.0
19+
container_name: mongodb
20+
restart: unless-stopped
21+
env_file: .env
22+
environment:
23+
- MONGO_INITDB_ROOT_USERNAME=$DB_USER
24+
- MONGO_INITDB_ROOT_PASSWORD=$DB_PASS
25+
- MONGO_INITDB_DATABASE=$DB_NAME
26+
ports:
27+
- "$DB_PORT:$DB_PORT"
28+
volumes:
29+
- dbdata:/data/db
30+
31+
volumes:
32+
dbdata:

0 commit comments

Comments
 (0)