mirror of
https://github.com/darmiel/yaxc.git
synced 2025-09-06 14:35:57 +08:00
Added Dockerfile
This commit is contained in:
parent
8beca5d0db
commit
f17fb582e2
1 changed files with 22 additions and 0 deletions
22
Dockerfile
Normal file
22
Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM golang:latest AS builder
|
||||||
|
|
||||||
|
LABEL maintainer="darmiel <hi@d2a.io>"
|
||||||
|
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
|
||||||
|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o yaxc .
|
||||||
|
|
||||||
|
# Output Image
|
||||||
|
FROM alpine
|
||||||
|
COPY --from=builder /usr/src/app/yaxc .
|
||||||
|
RUN ls -larth /
|
||||||
|
ENTRYPOINT ["/yaxc"]
|
Loading…
Add table
Reference in a new issue