-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
34 lines (29 loc) · 995 Bytes
/
Dockerfile.backend
File metadata and controls
34 lines (29 loc) · 995 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
# build main app
ARG GOLANG_VERSION=1.24
ARG GOLANG_IMAGE=alpine
ARG TARGET_DISTR_TYPE
ARG TARGET_DISTR_VERSION
FROM golang:${GOLANG_VERSION}-${GOLANG_IMAGE} AS builder
ARG LDFLAGS
ARG GOOS=linux
ARG GOARCH=amd64
WORKDIR /source
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
RUN GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -trimpath -o bin/dosasm ./cmd/
ARG TARGET_DISTR_TYPE
ARG TARGET_DISTR_VERSION
FROM ${TARGET_DISTR_TYPE}:${TARGET_DISTR_VERSION} AS dosasm
ARG APP_USER
RUN adduser -Ds /bin/sh ${APP_USER}
RUN apk update && apk add --no-cache bind-tools ca-certificates && update-ca-certificates
WORKDIR /app
COPY --from=builder /source/bin/dosasm .
ENTRYPOINT ["./dosasm"]
# k8s image: includes config, migrations and templates (config has {{VAR}} placeholders substituted from env at runtime)
FROM dosasm AS dosasm-k8s
COPY config/dosasm/ /app/config/
COPY sql/ /app/migrations/
COPY www/templates/ /app/www/templates/