File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM golang:1.15-alpine AS builder
2+
3+ # Set necessary environmet variables needed for our image
4+ ENV CGO_ENABLED=1 \
5+ GOOS=linux
6+
7+ # Move to working directory /build
8+ WORKDIR /build
9+
10+ # Copy the code into the container
11+ COPY . .
12+
13+ # Additional packages required
14+ RUN apk -U add musl-dev gcc
15+
16+ # Build the application
17+ RUN go build -v -a -tags netgo -ldflags '-w -extldflags "-static"' .
18+
19+ # Move to /dist directory as the place for resulting binary folder
20+ WORKDIR /dist
21+
22+ # Copy binary from build to main folder
23+ RUN cp /build/github2telegram .
24+
25+ # Build a small image
26+ FROM scratch
27+
28+ WORKDIR /app
29+
30+ COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.pem
31+ COPY --from=builder /dist/github2telegram /app
32+
33+ # Command to run
34+ ENTRYPOINT ["/app/github2telegram" ]
You can’t perform that action at this time.
0 commit comments