Skip to content

Commit

Permalink
Minor improvements to the docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Timshel committed Oct 11, 2024
1 parent 4395ddc commit 7c936fb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 29 deletions.
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Base
FROM node:18-alpine as base
ENV NODE_ENV production
FROM node:18-alpine AS base

ENV NODE_ENV=production
ENV MAILDEV_WEB_PORT=1080
ENV MAILDEV_SMTP_PORT=1025
ENV MAILDEV_MAIL_DIRECTORY=/tmp/maildev

# Build
FROM base as build
FROM base AS build
WORKDIR /root
COPY . .
RUN npm install typescript -g \
Expand All @@ -14,18 +18,19 @@ RUN npm install typescript -g \
&& npm run build

# Prod
FROM base as prod
FROM base AS prod

RUN mkdir -p /tmp/maildev && chown node:node /tmp/maildev

USER node
WORKDIR /home/node

COPY --chown=node:node . /home/node
COPY --chown=node:node --from=build /root/node_modules /home/node/node_modules
COPY --chown=node:node . .
COPY --chown=node:node --from=build /root/node_modules ./node_modules
COPY --chown=node:node --from=build /root/dist ./dist
COPY --chown=node:node bin ./bin

EXPOSE 1080 1025
ENV MAILDEV_WEB_PORT 1080
ENV MAILDEV_SMTP_PORT 1025
EXPOSE $MAILDEV_WEB_PORT $MAILDEV_SMTP_PORT

ENTRYPOINT ["bin/maildev"]
HEALTHCHECK --interval=10s --timeout=1s \
CMD wget -O - http://localhost:${MAILDEV_WEB_PORT}${MAILDEV_BASE_PATHNAME}/healthz || exit 1
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ For a guide for usage with Docker,

$ docker run -p 1080:1080 -p 1025:1025 timshel/maildev

By default the following environment variables are set:

- MAILDEV_WEB_PORT=1080
- MAILDEV_SMTP_PORT=1025
- MAILDEV_MAIL_DIRECTORY=/tmp/maildev

## Usage

```
Expand Down
18 changes: 0 additions & 18 deletions docker-compose.yml

This file was deleted.

3 changes: 2 additions & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ To use MailDev with Docker Compose, add the following to your

```yaml
maildev:
image: maildev/maildev
image: timshel/maildev
ports:
- "1025:1025"
- "1080:1080"
```
Expand Down

0 comments on commit 7c936fb

Please sign in to comment.