Building a docker image for the Broker service
This commit is contained in:
parent
8056721dc2
commit
0dc982e38b
21
broker-service/broker-service.dockerfile
Normal file
21
broker-service/broker-service.dockerfile
Normal 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"]
|
11
project/docker-compose.yml
Normal file
11
project/docker-compose.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user