From 999806fa622c6da2a8f231bab2ca7a63119679a9 Mon Sep 17 00:00:00 2001 From: Adrian PETERCA Date: Tue, 2 Jun 2026 17:42:08 +0300 Subject: [PATCH 1/2] Updated Dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 330d5ad..4b9d7e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,9 @@ FROM golang:1.24 AS builder WORKDIR /app -COPY go.mod go.sum ./ +# No additional dependencies, no go.sum +# COPY go.mod go.sum ./ +COPY go.mod ./ RUN go mod download COPY . . From 246d6029233af31584808c162fbb0470a3edf00e Mon Sep 17 00:00:00 2001 From: Adrian PETERCA Date: Tue, 2 Jun 2026 19:01:49 +0300 Subject: [PATCH 2/2] Fixed errors with Dockerfile --- .gitignore | 3 ++- Dockerfile | 14 +++++++++++--- README.md | 5 ++++- config.go | 10 +++++----- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 8b29b7a..1499f03 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ uploads bin # Other files -todo.md \ No newline at end of file +todo.md +build-docker.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4b9d7e4..578c523 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.24 AS builder +FROM golang:1.26 AS builder WORKDIR /app @@ -7,14 +7,22 @@ WORKDIR /app COPY go.mod ./ RUN go mod download -COPY . . +COPY static/ ./static/ +COPY templates/ ./templates/ +COPY *.go ./ RUN CGO_ENABLED=0 GOOS=linux go build -o curier . FROM scratch +WORKDIR / + +ENV CURIER_HOST="0.0.0.0" +ENV CURIER_PORT="39800" +ENV CURIER_STORAGE_PATH="/uploads/" + COPY --from=builder /app/curier /curier -EXPOSE 8080 +EXPOSE 39800 ENTRYPOINT ["/curier"] \ No newline at end of file diff --git a/README.md b/README.md index 239c265..a98a43e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A small Go server for sharing files across the internet. You can download the Dockerfile and build the image yourself, or simply pull it from the repo: ```bash docker pull ghcr.io/adipeterca/curier:latest -docker run -p 8080:8080 ghcr.io/adipeterca/curier:latest +docker run -p 39800:39800 ghcr.io/adipeterca/curier:latest ``` ### Linux environment @@ -26,6 +26,9 @@ You can download a precompiled binary from the [Release](https://github.com/adip ## Configuration You can configure some aspects of the service via environment variables prefixed with **CURIER_**. + +_If you're using Docker, either use a `.env` file or the `-e` argument from the `docker run` command._ + Some information will be exposed via the `/config/` endpoint for better UX. For default values, check [config.go](https://github.com/adipeterca/curier/blob/main/config.go). diff --git a/config.go b/config.go index 9b2539f..1142008 100644 --- a/config.go +++ b/config.go @@ -17,16 +17,16 @@ var templateFiles embed.FS // -- Private variables --- // Where to save the uploaded files -var storagePath = "/var/lib/curier/uploads/" +var storagePath = "uploads/" // URL base path that will prefix all download links var urlBasePath = "http://localhost" -// Network address to bind to - default 127.0.0.1 -var host = "127.0.0.1" +// Network address to bind to - default 0.0.0.0 +var host = "0.0.0.0" -// Port to listen on - default 8080 -var port = "8080" +// Port to listen on - default 39800 +var port = "39800" // --- Public variables --- //