hedgedoc/backend/docker
Emmanuel Ferdman 3e0d84f031
Some checks failed
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
E2E Tests / Build test build of frontend (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (push) Has been cancelled
Run tests & build / Test and build with NodeJS 20 (push) Has been cancelled
E2E Tests / frontend-cypress (1) (push) Has been cancelled
E2E Tests / frontend-cypress (2) (push) Has been cancelled
E2E Tests / frontend-cypress (3) (push) Has been cancelled
fix(docker): update docker documentation reference
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-09-17 01:35:45 +02:00
..
Dockerfile fix(docker): update docker documentation reference 2024-09-17 01:35:45 +02:00
README.md fix(config): Replace HD_DOMAIN and HD_EDITOR_BASE_URL with HD_BASE_URL 2023-02-05 22:32:31 +01:00

Using HedgeDoc with Docker

Important: This README does not refer to HedgeDoc 1. For setting up HedgeDoc 1 with Docker, see https://docs.hedgedoc.org/setup/docker/.

The Dockerfile in this repo uses multiple stages and can be used to create both images for development and images with only production dependencies. It uses features which are only available in BuildKit - see https://docs.docker.com/go/buildkit/ for more information.

Build a production image

Note: This does not include any frontend!

To build a production image, run the following command from the root of the repository:
docker buildx build -t hedgedoc-prod -f backend/docker/Dockerfile .

When you run the image, you need to provide environment variables to configure HedgeDoc. See the config docs for more information. This example starts HedgeDoc on localhost, with non-persistent storage:
docker run -e HD_BASE_URL=http://localhost -e HD_MEDIA_BACKEND=filesystem -e HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH=uploads -e HD_DATABASE_TYPE=sqlite -e HD_DATABASE_NAME=hedgedoc.sqlite -e HD_SESSION_SECRET=foobar -e HD_LOGLEVEL=debug -p 3000:3000 hedgedoc-prod

Build a development image

You can build a development image using the development target:
docker buildx build -t hedgedoc-dev -f backend/docker/Dockerfile --target development .

You can then, e.g. run tests inside the image:
docker run hedgedoc-dev yarn run test:e2e