Migrate to gomodules

This commit is contained in:
klmp200 2020-11-10 20:37:11 +01:00
parent 7b26cc3640
commit 35eab30bcd
4 changed files with 91 additions and 52 deletions

View file

@ -1,27 +1,16 @@
FROM golang:1.11 AS builder
# Download and install the latest release of dep
# ADD https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 /usr/bin/dep
# RUN chmod +x /usr/bin/dep
WORKDIR /go/src/git.klmp200.net/ALFRED/ALFRED
FROM golang:1.14 AS builder
RUN mkdir /build
WORKDIR /build
# Copy the code from the host and compile it
COPY . .
RUN go get -v -d ./...
RUN mkdir res
COPY settings.json res
COPY quotes.json res
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o /app .
# We use Alpine for it's ca-certificates needed by http lib
FROM alpine:3.4
RUN apk add --no-cache ca-certificates apache2-utils
FROM scratch
# We need ca-certifactes for http calls
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app ./
COPY --from=builder /go/src/git.klmp200.net/ALFRED/ALFRED/res ./
COPY --from=builder /build/res ./
ENTRYPOINT ["./app"]