Dockerfile (view raw)
1# syntax=docker/dockerfile:1
2
3FROM golang:alpine AS builder
4
5WORKDIR /build
6
7# Download Go modules
8COPY go.mod go.sum ./
9RUN go mod download
10
11# Transfer source code
12COPY telegram ./telegram
13COPY webui ./webui
14COPY index.html ./
15COPY *.go ./
16
17# Build
18RUN CGO_ENABLED=0 go build -trimpath -o /dist/app
19COPY index.html /dist
20
21# Test
22FROM build-stage AS run-test-stage
23RUN go test -v ./...
24
25FROM scratch AS build-release-stage
26
27COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
28COPY --from=builder /dist /app
29
30WORKDIR /app
31
32ENTRYPOINT ["/app/app"]