forked from tamzrod/modbus-replicator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (22 loc) · 747 Bytes
/
Dockerfile
File metadata and controls
36 lines (22 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Dockerfile
# Modbus Replicator – with baked-in example config
FROM golang:1.25.0-alpine AS build
WORKDIR /app
RUN apk add --no-cache ca-certificates
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -o replicator ./cmd/replicator
# ---- runtime image ----
FROM alpine:3.19
WORKDIR /app
RUN apk add --no-cache ca-certificates
# binary
COPY --from=build /app/replicator /usr/local/bin/replicator
# default example config (baked in)
COPY --from=build /app/internal/config/example.yaml /config/replicator.yaml
# config directory exists by default
VOLUME ["/config"]
ENTRYPOINT ["/usr/local/bin/replicator"]
CMD ["/config/replicator.yaml"]