mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 15:13:30 +00:00
22 lines
564 B
Docker
22 lines
564 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM golang:1.23.1 AS builder
|
|
|
|
# Set destination for COPY
|
|
WORKDIR /app
|
|
|
|
# Download Go modules
|
|
COPY go.mod go.sum ./
|
|
# Copy the source code. Note the slash at the end, as explained in
|
|
# https://docs.docker.com/engine/reference/builder/#copy
|
|
COPY *.go ./
|
|
|
|
RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct && go mod download
|
|
|
|
# Build
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /worker
|
|
|
|
FROM alpine:3
|
|
RUN apk add --no-cache pngquant jpegoptim
|
|
COPY --from=builder /app/worker /bin/worker
|
|
ENTRYPOINT ["/bin/worker"] |