From 7f4eb7d5da6efe0548ff395a76e165bb98c5b25a Mon Sep 17 00:00:00 2001 From: skidoodle Date: Tue, 21 Apr 2026 06:15:10 +0200 Subject: [PATCH] fix docker --- Dockerfile | 19 ++++++------------- Dockerfile.release | 6 ++++++ README.md | 2 +- compose.dev.yaml | 2 ++ compose.yaml | 6 +++--- 5 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 Dockerfile.release diff --git a/Dockerfile b/Dockerfile index 0cc5fbe..b078d42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,14 @@ FROM golang:1.25.1-alpine AS builder -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . -RUN go generate ./... -RUN go build -ldflags="-w -s" -o /pastebin . +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o pastebin . -FROM alpine:latest -RUN apk --no-cache add ca-certificates -RUN addgroup -S appgroup && adduser -S appuser -G appgroup -RUN mkdir /data && chown appuser:appgroup /data -USER appuser -COPY --from=builder /pastebin /pastebin -COPY --from=builder /app/view/style.css /view/style.css +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /app/pastebin /pastebin +COPY --from=builder /app/view /view EXPOSE 3000 VOLUME /data -ENTRYPOINT ["/pastebin", "-db-path=/data/pastebin.db"] +ENTRYPOINT ["/pastebin", "-addr", ":3000", "-db-path", "/data/pastebin.db"] diff --git a/Dockerfile.release b/Dockerfile.release new file mode 100644 index 0000000..42f5d47 --- /dev/null +++ b/Dockerfile.release @@ -0,0 +1,6 @@ +FROM scratch +COPY pastebin /pastebin +COPY view /view +EXPOSE 3000 +VOLUME /data +ENTRYPOINT ["/pastebin", "-addr", ":3000", "-db-path", "/data/pastebin.db"] diff --git a/README.md b/README.md index 4dcd974..049cb27 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ services: ports: - "3000:3000" volumes: - - ./data:/app/database + - ./data:/data ``` ### Manual Installation diff --git a/compose.dev.yaml b/compose.dev.yaml index ade981a..a52bbd1 100644 --- a/compose.dev.yaml +++ b/compose.dev.yaml @@ -6,3 +6,5 @@ services: dockerfile: Dockerfile ports: - "3000:3000" + volumes: + - ./data:/data diff --git a/compose.yaml b/compose.yaml index ffb073a..acd76ce 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,12 +1,12 @@ services: pastebin: container_name: pastebin - image: ghcr.io/skidoodle/pastebin:main + image: ghcr.io/skidoodle/pastebin:latest restart: unless-stopped ports: - - 3000:3000 + - "3000:3000" volumes: - pastebin_data:/data volumes: - pastebin_data: \ No newline at end of file + pastebin_data: