~erock/pico

ref: 90951e09568b61d17747a4a76036f2a876fe3f3e pico/Dockerfile -rw-r--r-- 843 bytes
90951e09Eric Bower fix(lists): wrong anchor links 3 months ago
                                                                                
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
37
38
39
40
41
42
43
44
45
46
47
FROM --platform=$BUILDPLATFORM golang:1.18-alpine as builder-deps
LABEL maintainer="Pico Maintainers <hello@pico.sh>"

ENV CGO_ENABLED 0

WORKDIR /app

RUN apk add --no-cache git

COPY go.* ./

RUN go mod download

FROM builder-deps as builder

COPY . .

ARG APP=lists
ARG TARGETOS
ARG TARGETARCH

ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}

RUN go build -o /go/bin/${APP}-ssh -ldflags="-s -w" ./cmd/${APP}/ssh
RUN go build -o /go/bin/${APP}-web -ldflags="-s -w" ./cmd/${APP}/web

FROM scratch as release-ssh

WORKDIR /app

ARG APP=lists

COPY --from=builder /go/bin/${APP}-ssh ./ssh

ENTRYPOINT ["/app/ssh"]

FROM scratch as release-web

WORKDIR /app

ARG APP=lists

COPY --from=builder /go/bin/${APP}-web ./web
COPY --from=builder /app/${APP}/html ./${APP}/html
COPY --from=builder /app/${APP}/public ./${APP}/public

ENTRYPOINT ["/app/web"]