Skip to content

Commit

Permalink
update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza-fa committed Dec 26, 2023
1 parent 4956053 commit 8d3a995
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
33 changes: 33 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,39 @@ services:
- webapi_network
restart: always

####################### App #######################################
car-api1:
build: ../src/
image: car-api:latest
container_name: web-api1
environment:
- PORT=9003
ports:
- 9003:5000
networks:
- webapi_network
volumes:
- logs:/app/logs
depends_on:
- postgres
restart: unless-stopped

car-api2:
build: ../src/
image: car-api:latest
container_name: web-api2
environment:
- PORT=9002
ports:
- 9002:5000
networks:
- webapi_network
volumes:
- logs:/app/logs
depends_on:
- postgres
restart: unless-stopped

####################### VOLUME AND NETWORKS #######################
volumes:
postgres:
Expand Down
23 changes: 23 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.21 as builder

WORKDIR /app

COPY go.* ./
RUN go mod download

COPY . ./

RUN go build -v -o server ./cmd/main.go

FROM debian:12.4-slim
RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive \
rm -rf /var/lib/apt/lists/*

COPY --from=builder /app/server /app/server
COPY --from=builder /app/config/config-docker.yml /app/config/config-docker.yml
COPY --from=builder /app/docs app/docs

ENV APP_ENV docker
ENV PORT ${Port}

CMD [ "app/server" ]
4 changes: 2 additions & 2 deletions src/config/config-production.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server:
internalPort: 5005
externalPort: 5005
internalPort: 5010
externalPort: 5010
runMode: release
logger:
filePath: /logs/
Expand Down

0 comments on commit 8d3a995

Please sign in to comment.