-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 746 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 746 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
31
32
33
34
FROM golang:1.21-alpine AS builder
# Set necessary environmet variables needed for our image
ENV CGO_ENABLED=1 \
GOOS=linux
# Move to working directory /build
WORKDIR /build
# Copy the code into the container
COPY . .
# Additional packages required
RUN apk -U add musl-dev gcc
# Build the application
RUN go build -v -a -tags netgo -ldflags '-w -extldflags "-static"' .
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/github2telegram .
# Build a small image
FROM scratch
WORKDIR /app
COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.pem
COPY --from=builder /dist/github2telegram /app
# Command to run
ENTRYPOINT ["/app/github2telegram"]