yaxc/Dockerfile

29 lines
688 B
Text
Raw Permalink Normal View History

2021-04-03 21:12:00 +08:00
FROM golang:latest AS builder
LABEL maintainer="darmiel <hi@d2a.io>"
2021-04-05 18:37:33 +08:00
LABEL org.opencontainers.image.source = "https://github.com/darmiel/yaxc"
2021-04-05 18:15:36 +08:00
2021-04-03 21:12:00 +08:00
WORKDIR /usr/src/app
# Install dependencies
# Thanks to @montanaflynn
# https://github.com/montanaflynn/golang-docker-cache
COPY go.mod go.sum ./
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
# Copy remaining source
COPY . .
# Build from sources
2021-05-18 00:15:06 +08:00
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags client,server -o yaxc .
2021-04-03 21:12:00 +08:00
# Output Image
FROM alpine
COPY --from=builder /usr/src/app/yaxc .
2021-05-15 20:56:51 +08:00
# Copy assets
RUN mkdir /assets
COPY --from=builder /usr/src/app/assets/ /assets
RUN ls -larth /assets
ENTRYPOINT ["/yaxc"]