1
0

reusing docker stages

This commit is contained in:
2022-05-07 11:41:50 +02:00
parent fc1e2424db
commit 22256fda6b

View File

@ -1,24 +1,10 @@
# building the go program
FROM golang:1.15.6-alpine AS builder
RUN apk add --no-cache git
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
COPY core ./core/
RUN go build -o gogodiscordo
# downloading mbrola voice
FROM alpine as alpine_voices
WORKDIR /tmp
RUN wget --no-check-certificate https://github.com/numediart/MBROLA-voices/archive/master.zip \
&& unzip master.zip && rm master.zip
# final image
FROM ubuntu:focal as ubuntu1
@ -35,7 +21,28 @@ RUN set -ex;\
RUN mkdir -p /usr/share/mbrola/
COPY --from=builder /src/gogodiscordo /app/
# setting up builder
FROM golang:1.15.6-alpine AS builder
RUN apk add --no-cache git
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /src
# compiling the go project
FROM builder as builder2
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
COPY core ./core/
RUN go build -o gogodiscordo
FROM ubuntu1 as ubuntu2
COPY --from=builder2 /src/gogodiscordo /app/
COPY config.yaml /app/
COPY --from=alpine_voices /tmp/MBROLA-voices-master/data/fr* /usr/share/mbrola/