-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (24 loc) · 814 Bytes
/
Dockerfile
File metadata and controls
30 lines (24 loc) · 814 Bytes
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
FROM golang:1.17.1 as builder
WORKDIR /app
COPY . .
ARG TARGETOS
ARG TARGETARCH
ARG VERSION
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o main -ldflags "-X main.Version=${VERSION}" .
FROM alpine:3.14.0
RUN apk --no-cache add ca-certificates
COPY --from=0 /app/main /app/main
EXPOSE 8080 8084
ENTRYPOINT ["/app/main"]
# https://docs.docker.com/develop/develop-images/multistage-build/
# syntax=docker/dockerfile:1
# FROM golang:1.16
# WORKDIR /go/src/github.com/alexellis/href-counter/
# RUN go get -d -v golang.org/x/net/html
# COPY app.go ./
# RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
# FROM alpine:latest
# RUN apk --no-cache add ca-certificates
# WORKDIR /root/
# COPY --from=0 /go/src/github.com/alexellis/href-counter/app ./
# CMD ["./app"]