Skip to content

Commit 829493d

Browse files
committed
update gorealeaser to use root user to be able to access socket
1 parent 9ac50f2 commit 829493d

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ DBnest is a lightweight, self-hosted database management platform that allows de
3333
docker run -d \
3434
-p 8080:8080 \
3535
-v /var/run/docker.sock:/var/run/docker.sock \
36-
-v dbnest-data:/data \
36+
-v ~/config/dbnest:/data \
3737
cy01/dbnest:latest
3838
```
3939

@@ -73,7 +73,7 @@ Open `http://localhost:8080`
7373
# docker/docker-compose.yml
7474
services:
7575
dbnest:
76-
image: ghcr.io/sirrobot01/dbnest:latest
76+
image: cy01/dbnest:latest
7777
ports:
7878
- "8080:8080"
7979
volumes:
@@ -84,6 +84,8 @@ volumes:
8484
dbnest-data:
8585
```
8686
87+
88+
8789
## Development
8890
8991
```bash

docker/Dockerfile.goreleaser

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
# Final stage only - GoReleaser provides the binary
22
FROM alpine:latest
33

4-
# Install ca-certificates for HTTPS requests and wget for healthcheck
5-
RUN apk --no-cache add ca-certificates wget
6-
7-
# Create non-root user
8-
RUN addgroup -g 1000 dbnest && \
9-
adduser -D -s /bin/sh -u 1000 -G dbnest dbnest
4+
# Install ca-certificates for HTTPS requests, wget for healthcheck, and docker-cli
5+
RUN apk --no-cache add ca-certificates wget docker-cli
106

117
# Set working directory
128
WORKDIR /app
139

1410
# Copy the binary (GoReleaser puts it in build context)
1511
COPY dbnest .
1612

17-
# Make it executable and change ownership
18-
RUN chmod +x dbnest && \
19-
chown dbnest:dbnest dbnest
13+
# Make it executable
14+
RUN chmod +x dbnest
2015

21-
# Switch to non-root user
22-
USER dbnest
16+
# Create data directory
17+
RUN mkdir -p /data
2318

2419
# Expose ports
2520
EXPOSE 8080
2621

22+
# Run as root to access Docker socket
23+
# For better security in production, use a Docker socket proxy
24+
USER root
25+
2726
# Default command
2827
ENTRYPOINT ["/app/dbnest"]
2928
CMD ["--port", "8080", "--data", "/data", "--socket", "/var/run/docker.sock"]

0 commit comments

Comments
 (0)