mirror of
https://github.com/v1k45/pastepass.git
synced 2026-08-18 20:06:02 +00:00
Add support to run it in docker
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
FROM golang:1.22-alpine3.19 AS builder
|
||||
|
||||
# go mod cache layer
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . ./
|
||||
RUN CGO_ENABLED=0 go build -o /out/pastepass main.go
|
||||
|
||||
|
||||
FROM alpine:3.19
|
||||
|
||||
ENV USER=pastepass
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
ENV APP_DIR=/app
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
RUN apk add --no-cache tini ca-certificates \
|
||||
&& addgroup -g $GID -S $USER \
|
||||
&& adduser -u $UID -S -G $USER $USER
|
||||
|
||||
WORKDIR $APP_DIR
|
||||
COPY --from=builder /out/pastepass .
|
||||
|
||||
RUN mkdir -p $DATA_DIR && chown $UID:$GID $DATA_DIR
|
||||
|
||||
USER $USER
|
||||
EXPOSE 8008
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["./pastepass", "-db-path", "/data/pastepass.db"]
|
||||
@@ -52,6 +52,20 @@ Use the `-h` option to find all options:
|
||||
./pastepass -h
|
||||
```
|
||||
|
||||
#### Run with docker
|
||||
|
||||
Build the image
|
||||
|
||||
```bash
|
||||
git clone https://github.com/v1k45/pastepass.git && cd pastepass
|
||||
docker build -t pastepass .
|
||||
```
|
||||
|
||||
Run the image on the port 10001 with a volume mounted in `path/on/host` to store the database. ()
|
||||
```bash
|
||||
docker run -p 10001:8008 -v /path/on/host:/data pastepass
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
| Option | Description | Default |
|
||||
|
||||
Reference in New Issue
Block a user