Dockerfile: move elm to its own step

This commit is contained in:
Cadey Ratio 2020-01-18 08:13:33 -05:00
parent 4233054b6c
commit 9539843616
1 changed files with 9 additions and 10 deletions

View File

@ -1,21 +1,20 @@
FROM xena/go:1.13.5 AS build
FROM xena/go:1.13.5 AS go
WORKDIR /mi
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN GOBIN=/mi/bin go install ./cmd/...
RUN apk --no-cache add curl \
&& curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz \
&& gunzip elm.gz \
&& chmod +x ./elm \
&& mv elm /usr/local/bin \
&& cd ./frontend \
&& elm make --output ../static/main.js src/Main.elm
FROM xena/elm:0.19.1 AS elm
WORKDIR /mi
COPY ./frontend .
RUN elm make --output main.js src/Main.elm
FROM xena/alpine
COPY --from=build /mi/bin /usr/local/bin
COPY --from=go /mi/bin /usr/local/bin
COPY ./run /run
COPY --from=build /mi/static /mi/static
COPY --from=go /mi/static /mi/static
COPY --from=elm /mi/main.js /mi/static/main.js
WORKDIR /mi
CMD ["/bin/sh", "/run/start.sh"]