Skip to content

Commit ca6fe41

Browse files
author
Vladimir Smirnov
authored
Merge pull request #7 from wwwlde/patch-1
Dockerfile
2 parents 50ffe53 + 59d8f12 commit ca6fe41

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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"]

0 commit comments

Comments
 (0)