about summary refs log tree commit diff stats
path: root/Dockerfile
blob: 90dd0510667385e89d665a72329d49b624f55bdb (plain)
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
# syntax = docker/dockerfile:1

ARG GO_VERSION=1.22.1
FROM docker.io/library/golang:${GO_VERSION} as builder

WORKDIR /app

COPY --link go.mod .
RUN go mod download

COPY --link . .

# RUN go vet ./...
ENV ENV=production
RUN go run ./cmd/build

RUN cp -r static/.well-known static/* public
ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0
RUN go build ./cmd/server/

# Final stage for app image
FROM gcr.io/distroless/static

WORKDIR /app

# Copy built application
COPY --link config.toml .
COPY --from=builder /app/public public
COPY --from=builder /app/server server

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
EXPOSE 9091

ENV ENV=production
CMD [ "/app/server" ]