-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathDockerfile.linux
More file actions
23 lines (21 loc) · 794 Bytes
/
Dockerfile.linux
File metadata and controls
23 lines (21 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS builder
WORKDIR /app
RUN apk add --no-cache \
clang \
gcc \
make \
musl musl-dev \
ncurses ncurses-dev ncurses-libs ncurses-static
COPY . .
ENV PATH=${PATH}:/usr/local/go/bin
WORKDIR /app/cmd/yc
RUN go build -ldflags="-s -w" -o yc
FROM scratch AS final
COPY --from=builder /app/cmd/yc/yc /yc
ENTRYPOINT ["/yc"]
### command to build yc file (GO_VERSION is read from go.mod)
## If ARM64
# docker buildx build -f Dockerfile.linux --build-arg GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}') --target final -o type=local,dest=./bin/linux/arm64 .
## If x86_64
# docker buildx build -f Dockerfile.linux --build-arg GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}') --target final -o type=local,dest=./bin/linux/amd64 .