Building a docker image for the Broker service

This commit is contained in:
vinchent 2024-08-28 09:49:09 +02:00
parent 8056721dc2
commit 0dc982e38b
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,21 @@
# base go image
FROM golang:1.22-alpine as builder
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN CGO_ENABLED=0 go build -o brokerApp ./cmd/api
RUN chmod +x /app/brokerApp
# build a tiny docker image
FROM alpine:latest
RUN mkdir /app
COPY --from=builder /app/brokerApp /app
CMD ["/app/brokerApp"]

View File

@ -0,0 +1,11 @@
services:
broker-service:
build:
context: ./../broker-service/
dockerfile: ./../broker-service/broker-service.dockerfile
restart: always
ports:
- "8080:4000"
deploy:
mode: replicated
replicas: 1