diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..74fe4a9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:16-alpine + +ADD ./ /app +WORKDIR /app +RUN npm install --no-optional +COPY config.js.template config.js +CMD npm start diff --git a/README.md b/README.md index 288aff6..fb69395 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Community instances: ## TODO * Make the mobile version better -* Add docker image, docker-compose ## Why I should use Wikiless instead of Wikipedia? @@ -131,3 +130,14 @@ If you are like me, and you also like the NSA, feel free to contribute and add m ``` Wikiless should now be running at . + +### Docker & docker compose + +You can build a production image by running `docker build .` in the repo's root. + +For development, there's a `docker-compose.yml` that mounts the app code (for hot reload of code changes) and default config. Before running it, you need to install the dependencies: + +``` +$ docker compose run --rm web npm install --no-optionals +$ docker compose up +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..89077d0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.9" +services: + web: + image: node:16-alpine + environment: + REDIS_HOST: redis + volumes: + - .:/app + - ./config.js.template:/app/config.js + - node_modules:/app/node_modules + working_dir: /app + command: npm start + ports: + - 8080:8080 + redis: + image: "redis:alpine" +volumes: + node_modules: