Skip to content

Commit 9c830be

Browse files
committed
feat: use multistage build to minimize container size
1 parent 0441dd4 commit 9c830be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
# MailHog Dockerfile
33
#
44

5-
FROM golang:alpine
5+
FROM golang:alpine as builder
66

77
# Install MailHog:
88
RUN apk --no-cache add --virtual build-dependencies \
99
git \
1010
&& mkdir -p /root/gocode \
1111
&& export GOPATH=/root/gocode \
12-
&& go get github.com/mailhog/MailHog \
13-
&& mv /root/gocode/bin/MailHog /usr/local/bin \
14-
&& rm -rf /root/gocode \
15-
&& apk del --purge build-dependencies
12+
&& go get github.com/mailhog/MailHog
1613

14+
FROM alpine:3
1715
# Add mailhog user/group with uid/gid 1000.
1816
# This is a workaround for boot2docker issue #581, see
1917
# https://github.com/boot2docker/boot2docker/issues/581
2018
RUN adduser -D -u 1000 mailhog
2119

20+
COPY --from=builder /root/gocode/bin/MailHog /usr/local/bin/
21+
2222
USER mailhog
2323

2424
WORKDIR /home/mailhog

0 commit comments

Comments
 (0)