This commit is contained in:
Leandro Facchinetti 2020-07-24 09:03:17 +01:00
parent 451781ab37
commit 33e84b345a
3 changed files with 29 additions and 33 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
/node_modules
/static/feeds/*
!/static/feeds/.gitkeep
/static/alternate/*
!/static/alternate/.gitkeep

View File

@ -1,34 +1,21 @@
# use latest stable node FROM node:latest
FROM node:lts-alpine
# set build arguments WORKDIR /kill-the-newsletter
ARG VERSION=1.0.0
# set environment variables for container COPY package*.json ./
ENV BASE_URL=https://www.kill-the-newsletter.com \ RUN npm ci --production
EMAIL_DOMAIN=kill-the-newsletter.com \ COPY . .
ISSUE_REPORT=mailto:kill-the-newsletter@leafac.com
WORKDIR /src VOLUME /kill-the-newsletter/static/feeds/
VOLUME /kill-the-newsletter/static/alternate/
RUN apk --no-cache add git ENV WEB_PORT=8000
ENV EMAIL_PORT=2525
ENV BASE_URL=http://localhost:8000
ENV EMAIL_DOMAIN=localhost
ENV ISSUE_REPORT=mailto:kill-the-newsletter@leafac.com
# download release and unpack archive EXPOSE 8000
RUN wget -q -O release.tar.gz https://github.com/leafac/www.kill-the-newsletter.com/archive/$VERSION.tar.gz \ EXPOSE 2525
&& tar -C . -xzf release.tar.gz \
&& rm release.tar.gz \
&& mv www.kill-the-newsletter.com-$VERSION/* . \
&& rm -rf www.kill-the-newsletter.com-$VERSION/
# install dependencies CMD npx ts-node .
RUN npm install \
&& npm audit fix
VOLUME /static/feeds/
# expose http & smtp
EXPOSE 8000 \
25
# start application
CMD [ "npm", "start" ]

View File

@ -102,11 +102,15 @@ Install [Node.js](https://nodejs.org/) and run:
$ npm install-test $ npm install-test
``` ```
# Docker Support # Docker Support (Experimental)
Install [Docker](https://www.docker.com/get-started) and run: Install [Docker](https://www.docker.com/) and run:
```console ```console
$ docker build -t kill-the-newsletter:latest . $ docker build -t kill-the-newsletter .
$ docker run kill-the-newsletter:latest $ docker run kill-the-newsletter
``` ```
The web server will be running at `http://localhost:8000` and the email server at `smtp://localhost:2525`.
For use in production, start with the example [`Dockerfile`](Dockerfile).