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

View File

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