Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): proper rights for data directory #64

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading