Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove root user from docker, update ports and update Node / libraries #281

Merged
merged 13 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 22 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
FROM node:8-alpine
# Base
FROM node:10-alpine as base
MAINTAINER "Dan Farrelly <daniel.j.farrelly@gmail.com>"

ENV NODE_ENV production

RUN apk add --no-cache curl
# Build
FROM base as build

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
WORKDIR /root
COPY package*.json ./

ADD package*.json /usr/src/app/
jovanmaric marked this conversation as resolved.
Show resolved Hide resolved
RUN apk add --no-cache curl \
&& npm install \
&& npm prune \
&& npm cache clean --force \
&& rm package*.json

RUN npm install && \
npm prune && \
npm cache clean --force && \
rm -rf /tmp/*
# Prod
FROM base as prod

ADD . /usr/src/app/
USER node
WORKDIR /home/node
jovanmaric marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 80 25
COPY --chown=node:node . /home/node
COPY --chown=node:node --from=build /root/node_modules /home/node/node_modules

ENTRYPOINT ["bin/maildev"]
CMD ["--web", "80", "--smtp", "25"]
EXPOSE 1080 1025
jovanmaric marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT ["/home/node/bin/maildev"]
CMD ["--web", "1080", "--smtp", "1025"]

HEALTHCHECK --interval=10s --timeout=1s \
CMD curl -k -f -v http://localhost/healthz || exit 1
CMD curl -k -f -v http://localhost:1080/healthz || exit 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you want to use MailDev with [Docker](https://www.docker.com/), you can use t
For a guide for usage with Docker,
[checkout the docs](https://github.com/maildev/maildev/blob/master/docs/docker.md).

$ docker run -p 1080:80 -p 1025:25 maildev/maildev
$ docker run -p 1080:1080 -p 1025:1025 maildev/maildev

For convenient use with Grunt, try [grunt-maildev](https://github.com/xavierpriour/grunt-maildev).

Expand Down
4 changes: 2 additions & 2 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you don't have the image on your machine, Docker will pull it. Let's name
it "maildev" and publish the interface on port `1080`:

```
$ docker run -p 1080:80 --name maildev maildev/maildev
$ docker run -p 1080:1080 --name maildev maildev/maildev
```

Now the MailDev UI will be running at port `1080` on your virtual machine
Expand All @@ -39,7 +39,7 @@ The Dockerfile specifically EXPOSES port 80 and 25, therefor you need to tell ma
This example adds the base-pathname parameter.

```
$ docker run -p 1080:80 -p 1025:25 maildev/maildev bin/maildev --base-pathname /maildev -w 80 -s 25
$ docker run -p 1080:1080 -p 1025:1025 maildev/maildev bin/maildev --base-pathname /maildev -w 1080 -s 1025
```


Expand Down