[GH-ISSUE #2] Docker image #1

Closed
opened 2026-03-15 11:59:08 +03:00 by kerem · 2 comments
Owner

Originally created by @AnatomicJC on GitHub (Aug 4, 2022).
Original GitHub issue: https://github.com/axllent/mailpit/issues/2

Hi and thanks for this project 👍

If interested, I created a multiarch docker image for mailpit. I integrated it in my docker image sandboxes (I use buildah for multiarch build):

I don't know how do you want to handle the docker image, nor how do you plan to automate its deployment, would you be interested by a pull request ?

ARG CI_REGISTRY
FROM golang:1.19-alpine as builder
ARG VERSION=0.0.4
ARG GOOS
ARG GOARCH
ARG GOARM

RUN echo "Will build on GOOS/GOARCH/GOARM: ${GOOS}/${GOARCH}/${GOARM}" \
  && apk --no-cache add --virtual build-dependencies \
    git npm \
  && git clone -b ${VERSION} --depth 1 https://github.com/axllent/mailpit.git \
  && cd mailpit \
  && npm install \
  && npm run build \
  && CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -ldflags "-s -w" -o /mailpit

FROM scratch

COPY --from=builder /mailpit /mailpit

ENTRYPOINT ["/mailpit"]
Originally created by @AnatomicJC on GitHub (Aug 4, 2022). Original GitHub issue: https://github.com/axllent/mailpit/issues/2 Hi and thanks for this project 👍 If interested, I created a multiarch docker image for mailpit. I integrated it in my docker image sandboxes (I use buildah for multiarch build): * https://gitlab.com/AnatomicJC/docker-images/-/blob/main/Dockerfiles/mailpit/Dockerfile * https://gitlab.com/AnatomicJC/docker-images/-/pipelines/604102968 * https://hub.docker.com/r/anatomicjc/mailpit/tags I don't know how do you want to handle the docker image, nor how do you plan to automate its deployment, would you be interested by a pull request ? ``` ARG CI_REGISTRY FROM golang:1.19-alpine as builder ARG VERSION=0.0.4 ARG GOOS ARG GOARCH ARG GOARM RUN echo "Will build on GOOS/GOARCH/GOARM: ${GOOS}/${GOARCH}/${GOARM}" \ && apk --no-cache add --virtual build-dependencies \ git npm \ && git clone -b ${VERSION} --depth 1 https://github.com/axllent/mailpit.git \ && cd mailpit \ && npm install \ && npm run build \ && CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -ldflags "-s -w" -o /mailpit FROM scratch COPY --from=builder /mailpit /mailpit ENTRYPOINT ["/mailpit"] ```
kerem closed this issue 2026-03-15 11:59:13 +03:00
Author
Owner

@axllent commented on GitHub (Aug 4, 2022):

Thanks for your interest in Mailhog @AnatomicJC!

I'm actually already planning a multi-arch Docker image (within the next week or so), and I intend to build it as part of the Github Actions workflow when I release each version to automatically and push it to Docker hub. There are also a few environment variables (intended for Docker) that align with the command-line flags which I also need to document as part of that process.

I still need to work out how what I need to do for the multi-arch builds in Github Actions - but it can't be too hard. Your example Dockerfile is helpful though, so thank you, but no need for a pull request at this stage. BTW, you should change the npm run build to npm run package as the latter will also minify the compiled JS and CSS.

Please leave this issue open for now, and I'll close it when I have an "official" docker image 👍

<!-- gh-comment-id:1204897369 --> @axllent commented on GitHub (Aug 4, 2022): Thanks for your interest in Mailhog @AnatomicJC! I'm actually already planning a multi-arch Docker image (within the next week or so), and I intend to build it as part of the Github Actions workflow when I release each version to automatically and push it to Docker hub. There are also a few environment variables (intended for Docker) that align with the command-line flags which I also need to document as part of that process. I still need to work out how what I need to do for the multi-arch builds in Github Actions - but it can't be too hard. Your example Dockerfile is helpful though, so thank you, but no need for a pull request at this stage. BTW, you should change the `npm run build` to `npm run package` as the latter will also minify the compiled JS and CSS. Please leave this issue open for now, and I'll close it when I have an "official" docker image :+1:
Author
Owner

@AnatomicJC commented on GitHub (Aug 4, 2022):

Awesome!

Yes, my Dockerfile fits my needs (gitlab and buildah as docker image builder), and I think you already have ideas about how you want the official image be like :)

Thank you for this project, I come from mailhog and will follow your project closely 👍

Cheers,

<!-- gh-comment-id:1204932785 --> @AnatomicJC commented on GitHub (Aug 4, 2022): Awesome! Yes, my Dockerfile fits my needs (gitlab and buildah as docker image builder), and I think you already have ideas about how you want the official image be like :) Thank you for this project, I come from mailhog and will follow your project closely 👍 Cheers,
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#1
No description provided.