-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 837 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 837 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
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /src
COPY go.mod ./
COPY cmd ./cmd
COPY internal ./internal
RUN set -eux; \
target_os="${TARGETOS:-linux}"; \
target_arch="${TARGETARCH:-amd64}"; \
if [ "$target_arch" = "arm" ]; then \
export GOARM="${TARGETVARIANT#v}"; \
if [ -z "$GOARM" ]; then export GOARM=7; fi; \
fi; \
mkdir -p /out; \
CGO_ENABLED=0 GOOS="$target_os" GOARCH="$target_arch" \
go build -trimpath -ldflags="-s -w" -o /out/ecs-controller ./cmd/ecs-controller
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /out/ecs-controller ./ecs-controller
COPY web ./web
EXPOSE 8080
VOLUME ["/data"]
ENTRYPOINT ["/app/ecs-controller"]