Updated Dockerfile

This commit is contained in:
Eduard Urbach 2019-04-08 20:18:18 +09:00
parent 9e7a3adbdf
commit 020ebd1f17

View File

@ -1,17 +1,26 @@
# Development
FROM golang:1.12.2-alpine as builder FROM golang:1.12.2-alpine as builder
RUN mkdir /notify.moe RUN apk add --no-cache git nodejs npm make gcc libc-dev
ADD . /notify.moe
WORKDIR /notify.moe
ENV ARN_ROOT /notify.moe
RUN apk add git nodejs npm make gcc libc-dev
RUN npm i -g typescript RUN npm i -g typescript
RUN go mod download
RUN make tools && make assets
RUN GOOS=linux go build
RUN git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn RUN git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
ENV GO111MODULE=on
RUN go install github.com/aerogo/pack && \
go install github.com/aerogo/run && \
go install golang.org/x/tools/cmd/goimports
RUN mkdir /notify.moe
ADD go.mod go.sum /notify.moe/
WORKDIR /notify.moe
RUN go mod download
ADD . /notify.moe
RUN tsc && \
pack && \
GOOS=linux go build
# Production
FROM alpine:latest as production FROM alpine:latest as production
RUN apk add ca-certificates
COPY --from=builder /root/.aero /root/.aero COPY --from=builder /root/.aero /root/.aero
COPY --from=builder /notify.moe /notify.moe COPY --from=builder /notify.moe /notify.moe
ENV ARN_ROOT=/notify.moe
WORKDIR /notify.moe WORKDIR /notify.moe
CMD ["./notify.moe"] CMD ["./notify.moe"]