Merge pull request #12 from prologic/improved_dockerfile

Improved Dockerfile to properly build and ship a runtime image
This commit is contained in:
Ken-Håvard Lieng 2018-05-18 00:58:22 +02:00 committed by GitHub
commit ed0c413542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
build
release
dispatch
client/dist
client/node_modules
client/yarn-error.log

View File

@ -1,7 +1,22 @@
FROM scratch
# Build
FROM golang:alpine AS build
ADD build/dispatch /
ADD ca-certificates.crt /etc/ssl/certs/
RUN apk add --update git make build-base && \
rm -rf /var/cache/apk/*
WORKDIR /go/src/github.com/khlieng/dispatch
COPY . /go/src/github.com/khlieng/dispatch
RUN go build .
# Runtime
FROM alpine
RUN apk add --update ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=build /go/src/github.com/khlieng/dispatch/dispatch /dispatch
EXPOSE 80/tcp
VOLUME ["/data"]