Skip to content

Commit e15a365

Browse files
committed
Docker compose for the rest API
1 parent 7400b9b commit e15a365

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

Dockerfile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,4 @@ FROM alpine:latest
99
WORKDIR /app
1010
COPY --from=buildContainer /go/src/app/restapi .
1111

12-
ENV DBUSER root
13-
ENV DBPASSWORD jobs@123
14-
ENV DBNAME api
15-
ENV DBHOST localhost
16-
ENV DBPORT 3306
17-
18-
EXPOSE 8080
19-
2012
CMD ["./restapi"]
File renamed without changes.

docker-compose.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
21
services:
32
db:
43
image: mysql:latest
5-
#container_name: app_mysql
64
ports:
75
- "3306:3306"
86
volumes:
97
- /home/karan/go/src/github.com/karanrn/go-rest-api/mysql/:/var/lib/mysql
108
environment:
11-
MYSQL_ROOT_PASSWORD: ${root_password}
9+
MYSQL_ROOT_PASSWORD: "${ROOT_PASSWORD}"
10+
app:
11+
build: .
12+
ports:
13+
- "8080:8080"
14+
environment:
15+
DBUSER: "${DB_USER}"
16+
DBPASSWORD: "${DB_PASSWORD}"
17+
DBNAME: api
18+
DBHOST: db
19+
DBPORT: 3306
20+
depends_on:
21+
- db

0 commit comments

Comments
 (0)