Skip to content

Commit d9e191a

Browse files
authored
Create Dockerfile
Dockerfile to build Docker container
1 parent 50ffe53 commit d9e191a

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM golang:1.14 AS builder
2+
3+
# Set necessary environmet variables needed for our image
4+
ENV CGO_ENABLED=1 \
5+
GOOS=linux \
6+
GOARCH=arm64
7+
8+
# Move to working directory /build
9+
WORKDIR /build
10+
11+
# Copy the code into the container
12+
COPY . .
13+
14+
# Build the application
15+
RUN go build -v -a -tags netgo -ldflags '-w -extldflags "-static"' .
16+
17+
# Move to /dist directory as the place for resulting binary folder
18+
WORKDIR /dist
19+
20+
# Copy binary from build to main folder
21+
RUN cp /build/github2telegram .
22+
23+
# Build a small image
24+
FROM scratch
25+
26+
WORKDIR /app
27+
28+
COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.pem
29+
COPY --from=builder /dist/github2telegram /app
30+
31+
# Command to run
32+
ENTRYPOINT ["/app/github2telegram"]

0 commit comments

Comments
 (0)