Skip to content

Commit

Permalink
fix(docker): proper rights for data directory (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinTh authored Aug 31, 2024
1 parent 10645e0 commit 66adeb1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 66adeb1

Please sign in to comment.