Updated docker build

This commit is contained in:
Eduard Urbach 2019-04-09 17:49:05 +09:00
parent 8c6b8c27aa
commit fe6e7a47b6
3 changed files with 11 additions and 17 deletions

View File

@ -1,30 +1,27 @@
# Install development environment
FROM golang:1.12.2-alpine as builder
ENV GO111MODULE=on
RUN apk add --no-cache git nodejs npm make gcc libc-dev && \
RUN apk add --no-cache git nodejs npm make gcc musl-dev && \
npm i -g typescript && \
go install github.com/aerogo/pack && \
go install github.com/aerogo/run && \
go install golang.org/x/tools/cmd/goimports && \
git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn && \
mkdir /notify.moe
git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn
WORKDIR /notify.moe
# Download dependencies when go.mod or go.sum changes
COPY go.mod go.sum /notify.moe/
WORKDIR /notify.moe
COPY go.mod go.sum ./
RUN go mod download
# Run Typescript compiler when scripts change
COPY ./scripts /notify.moe/scripts
COPY ./tsconfig.json /notify.moe/
WORKDIR /notify.moe
COPY ./tsconfig.json ./
COPY ./scripts ./scripts
RUN tsc
# Build
COPY . /notify.moe/
WORKDIR /notify.moe
COPY . ./
RUN pack && \
GOOS=linux go build
go build
# Production
FROM alpine:latest as production
@ -33,4 +30,4 @@ COPY --from=builder /root/.aero /root/.aero
COPY --from=builder /notify.moe /notify.moe
ENV ARN_ROOT=/notify.moe
WORKDIR /notify.moe
CMD ["./notify.moe"]
ENTRYPOINT ["./notify.moe"]

View File

@ -1,9 +1,6 @@
version: '3'
services:
app:
container_name: "notify.moe"
notify.moe:
build: .
ports:
- "443:4001"
environment:
ARN_ROOT: "/notify.moe"
- "443:4001"