reusing docker stages
This commit is contained in:
39
Dockerfile
39
Dockerfile
@ -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
|
# downloading mbrola voice
|
||||||
FROM alpine as alpine_voices
|
FROM alpine as alpine_voices
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
RUN wget --no-check-certificate https://github.com/numediart/MBROLA-voices/archive/master.zip \
|
RUN wget --no-check-certificate https://github.com/numediart/MBROLA-voices/archive/master.zip \
|
||||||
&& unzip master.zip && rm master.zip
|
&& unzip master.zip && rm master.zip
|
||||||
|
|
||||||
|
|
||||||
# final image
|
# final image
|
||||||
FROM ubuntu:focal as ubuntu1
|
FROM ubuntu:focal as ubuntu1
|
||||||
|
|
||||||
@ -35,7 +21,28 @@ RUN set -ex;\
|
|||||||
|
|
||||||
RUN mkdir -p /usr/share/mbrola/
|
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 config.yaml /app/
|
||||||
COPY --from=alpine_voices /tmp/MBROLA-voices-master/data/fr* /usr/share/mbrola/
|
COPY --from=alpine_voices /tmp/MBROLA-voices-master/data/fr* /usr/share/mbrola/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user