mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-27 08:14:04 +00:00
feat: use multistage build to minimize container size
This commit is contained in:
parent
0441dd494b
commit
9c830be100
1 changed files with 5 additions and 5 deletions
10
Dockerfile
10
Dockerfile
|
@ -2,23 +2,23 @@
|
||||||
# MailHog Dockerfile
|
# MailHog Dockerfile
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM golang:alpine
|
FROM golang:alpine as builder
|
||||||
|
|
||||||
# Install MailHog:
|
# Install MailHog:
|
||||||
RUN apk --no-cache add --virtual build-dependencies \
|
RUN apk --no-cache add --virtual build-dependencies \
|
||||||
git \
|
git \
|
||||||
&& mkdir -p /root/gocode \
|
&& mkdir -p /root/gocode \
|
||||||
&& export GOPATH=/root/gocode \
|
&& export GOPATH=/root/gocode \
|
||||||
&& go get github.com/mailhog/MailHog \
|
&& go get github.com/mailhog/MailHog
|
||||||
&& mv /root/gocode/bin/MailHog /usr/local/bin \
|
|
||||||
&& rm -rf /root/gocode \
|
|
||||||
&& apk del --purge build-dependencies
|
|
||||||
|
|
||||||
|
FROM alpine:3
|
||||||
# Add mailhog user/group with uid/gid 1000.
|
# Add mailhog user/group with uid/gid 1000.
|
||||||
# This is a workaround for boot2docker issue #581, see
|
# This is a workaround for boot2docker issue #581, see
|
||||||
# https://github.com/boot2docker/boot2docker/issues/581
|
# https://github.com/boot2docker/boot2docker/issues/581
|
||||||
RUN adduser -D -u 1000 mailhog
|
RUN adduser -D -u 1000 mailhog
|
||||||
|
|
||||||
|
COPY --from=builder /root/gocode/bin/MailHog /usr/local/bin/
|
||||||
|
|
||||||
USER mailhog
|
USER mailhog
|
||||||
|
|
||||||
WORKDIR /home/mailhog
|
WORKDIR /home/mailhog
|
||||||
|
|
Loading…
Reference in a new issue