diff --git a/Dockerfile b/Dockerfile index dddd3b82..ae8ca9a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,8 @@ WORKDIR /app COPY --from=builder /app/packages/app-client/dist ./public COPY --from=builder /app/packages/app-server/dist-node/index.cjs ./index.cjs -# Change the owner of the app directory -RUN chown -R nonroot:nonroot /app +# Create the .data directory and set permissions +RUN mkdir -p /app/.data && chown -R nonroot:nonroot /app # Change the user to nonroot USER nonroot diff --git a/README.md b/README.md index 8a6e7b21..bfaa2f29 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ Replace `/path/to/local/data` with the path to your local data directory. ```bash # From docker hub -docker run -d --name enclosed --restart unless-stopped -p 8787:8787 -v /path/to/local/data:/app/.data corentinth/enclosed +docker run -d --name enclosed --restart unless-stopped -p 8787:8787 -v /path/to/local/data:/app/.data --user $(id -u):$(id -g) corentinth/enclosed # or from GitHub Container Registry -docker run -d --name enclosed --restart unless-stopped -p 8787:8787 -v /path/to/local/data:/app/.data ghcr.io/corentin-th/enclosed +docker run -d --name enclosed --restart unless-stopped -p 8787:8787 -v /path/to/local/data:/app/.data --user $(id -u):$(id -g) ghcr.io/corentin-th/enclosed ``` ### Docker Compose @@ -56,8 +56,18 @@ services: ports: - 8787:8787 volumes: - - /path/to/local/data:/app/.data + - enclosed-data:/app/.data restart: unless-stopped + +volumes: + enclosed-data: + driver: local +``` + +Run the following commands to start the application. +```bash +curl -O https://raw.githubusercontent.com/CorentinTh/enclosed/main/docker-compose.yml +docker-compose up -d ``` ### Configuration diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..23f645a4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + enclosed: + image: corentinth/enclosed + ports: + - 8787:8787 + volumes: + - enclosed-data:/app/.data + restart: unless-stopped + +volumes: + enclosed-data: + driver: local \ No newline at end of file