Improved Dockerfile to properly build and ship a runtime image

This commit is contained in:
James Mills 2018-05-17 15:39:46 -07:00
parent 6fd5235ec9
commit 276d8f7849
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
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"]