-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
35 lines (24 loc) · 879 Bytes
/
Copy pathDockerfile.backend
File metadata and controls
35 lines (24 loc) · 879 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
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-bookworm AS builder
WORKDIR /app
ENV CGO_ENABLED=0 GOOS=linux GO111MODULE=on GOFLAGS=-mod=mod
# Install dependencies first (better layer caching)
COPY go.mod go.sum ./
RUN go env -w GO111MODULE=on && go mod download
# Copy the rest of the project (respecting .dockerignore)
COPY . .
# Build the backend binary
RUN go env -w GO111MODULE=on && go build -o /app/nofx .
FROM debian:bookworm-slim AS runner
WORKDIR /app
# Include CA certificates for outbound HTTPS calls (exchanges, data APIs)
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/nofx ./nofx
EXPOSE 8080
# Default config path can be overridden at runtime
ENV CONFIG_PATH=/config/config.json
ENTRYPOINT ["./nofx"]
CMD ["/config/config.json"]