2019-04-08 23:14:54 +00:00
|
|
|
# Install development environment
|
2019-04-08 10:16:59 +00:00
|
|
|
FROM golang:1.12.2-alpine as builder
|
2019-04-08 11:18:18 +00:00
|
|
|
ENV GO111MODULE=on
|
2019-04-09 08:49:05 +00:00
|
|
|
RUN apk add --no-cache git nodejs npm make gcc musl-dev && \
|
2019-04-08 23:14:54 +00:00
|
|
|
npm i -g typescript && \
|
|
|
|
go install github.com/aerogo/pack && \
|
2019-04-08 11:18:18 +00:00
|
|
|
go install github.com/aerogo/run && \
|
2019-04-08 23:14:54 +00:00
|
|
|
go install golang.org/x/tools/cmd/goimports && \
|
2019-04-09 08:49:05 +00:00
|
|
|
git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
|
|
|
|
WORKDIR /notify.moe
|
2019-04-08 23:14:54 +00:00
|
|
|
|
|
|
|
# Download dependencies when go.mod or go.sum changes
|
2019-04-09 08:49:05 +00:00
|
|
|
COPY go.mod go.sum ./
|
2019-04-08 05:43:13 +00:00
|
|
|
RUN go mod download
|
2019-04-08 23:14:54 +00:00
|
|
|
|
|
|
|
# Run Typescript compiler when scripts change
|
2019-04-09 08:49:05 +00:00
|
|
|
COPY ./tsconfig.json ./
|
|
|
|
COPY ./scripts ./scripts
|
2019-04-08 23:14:54 +00:00
|
|
|
RUN tsc
|
|
|
|
|
|
|
|
# Build
|
2019-04-09 08:49:05 +00:00
|
|
|
COPY . ./
|
2019-04-08 23:14:54 +00:00
|
|
|
RUN pack && \
|
2019-04-09 08:49:05 +00:00
|
|
|
go build
|
2019-04-08 10:16:59 +00:00
|
|
|
|
2019-04-08 11:18:18 +00:00
|
|
|
# Production
|
2019-04-08 10:16:59 +00:00
|
|
|
FROM alpine:latest as production
|
2019-04-09 06:22:44 +00:00
|
|
|
RUN apk add --no-cache ca-certificates
|
2019-04-08 10:16:59 +00:00
|
|
|
COPY --from=builder /root/.aero /root/.aero
|
|
|
|
COPY --from=builder /notify.moe /notify.moe
|
2019-04-08 11:18:18 +00:00
|
|
|
ENV ARN_ROOT=/notify.moe
|
2019-04-08 10:16:59 +00:00
|
|
|
WORKDIR /notify.moe
|
2019-04-09 08:49:05 +00:00
|
|
|
ENTRYPOINT ["./notify.moe"]
|