-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
25 lines (21 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
25 lines (21 loc) · 1.07 KB
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
# ── Build stage ──────────────────────────────────────────────────────
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS build
ARG TARGETOS TARGETARCH VERSION=dev
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags="-s -w -X main.version=${VERSION}" \
-o /stockyard ./cmd/stockyard/
# ── Runtime stage ────────────────────────────────────────────────────
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata curl
COPY --from=build /stockyard /usr/local/bin/stockyard
COPY --from=build /src/internal/site/static/tools/bundles.json /app/site/tools/bundles.json
WORKDIR /app
EXPOSE 4200
ENV DATA_DIR=/data PORT=4200
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:4200/health || exit 1
ENTRYPOINT ["stockyard"]