Update docker file to include the process of building a go app into the image build process (#33)

This commit is contained in:
Alex Manatskyi 2020-11-14 16:18:50 +02:00 committed by GitHub
parent 2365907fd7
commit 67a40f39b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,24 @@
FROM golang:alpine as build
ENV GOOS=linux \
GOARCH=amd64
RUN apk add --no-cache git
WORKDIR /go/src/transmission-telegram
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
RUN go build -o main .
FROM alpine:latest as certs FROM alpine:latest as certs
RUN apk --update add ca-certificates RUN apk --update add ca-certificates
FROM bash:latest FROM bash:latest
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY transmission-telegram / COPY --from=build /go/bin/transmission-telegram /
RUN chmod 777 transmission-telegram RUN chmod 777 transmission-telegram
ENTRYPOINT ["/transmission-telegram"] ENTRYPOINT ["/transmission-telegram"]