Skip to content
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
19 changes: 18 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v6
Expand All @@ -34,4 +35,20 @@ jobs:
with:
files: |
curier
curier.exe
curier.exe

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.24 AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o curier .

FROM scratch

COPY --from=builder /app/curier /curier

EXPOSE 8080

ENTRYPOINT ["/curier"]
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@ A small Go server for sharing files across the internet.

## How to setup

### Linux environment
### Docker environment

_I need to add this part, via a dedicated Bash script_
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
```

### Windows environment
### Linux environment

_I need to add this part, via a dedicated Powershell script_
**I strongly recommend using Docker, as it simplifies the configuration a lot**.

### Docker environment
If you want to use a precompiled binary, please refer to the [Release](https://github.com/adipeterca/curier/releases) section.

### Windows environment

_I need to add this part, either as a Dockerfile or an already built container_
Because not many servers run Windows, the support I can provide for this platform is limited.
You can download a precompiled binary from the [Release](https://github.com/adipeterca/curier/releases) section or use a Docker container.

## Configuration

You can configure some aspects of the service via environment variables prefixed with **CURIER_**.
| Variable name | Default value | Description |
|--|--|--|
|`CURIER_STORAGE_PATH`|`/var/lib/curier/uploads/` (Linux/Docker), `?` (Windows)|Absolute path where the file uploads will be stored on disk|
|`CURIER_BASE_URL`|`http://localhost`|Default prefix for the `/download/{id}` URL|
|`CURIER_HOST`|`127.0.0.1`|Network address to bind to|
|`CURIER_PORT`|`8080`|Port to use|
You can configure some aspects of the service via environment variables prefixed with **CURIER_**.
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).

| Variable name | Description |
|--|--|
|`CURIER_STORAGE_PATH`|Absolute path where the file uploads will be stored on disk|
|`CURIER_BASE_URL`|Default prefix for the `/download/{id}` URL|
|`CURIER_HOST`|Network address to bind to|
|`CURIER_PORT`|Port to use (also affects the port used inside the container)|
|`CURIER_MAX_FILE_SIZE`|Maximum allowed size for each file upload|
|`CURIER_ALLOWED_FILE_EXTENSIONS`|A `;` separated list of file extensions, lowercase only (the last entry needs to have a `;` too)|
30 changes: 30 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var templateFiles embed.FS
// Example:
// storagePath -> CURIER_STORAGE_PATH

// -- Private variables ---

// Where to save the uploaded files
var storagePath = "/var/lib/curier/uploads/"

Expand All @@ -25,3 +27,31 @@ var host = "127.0.0.1"

// Port to listen on - default 8080
var port = "8080"

// --- Public variables ---
//
// This information can be queried by a GET request to the `/config/` endpoint.

// Max accepted file size for upload - default 20 GB
var maxFileSize int64 = 20 * 1024 * 1024 * 1024

// What file types (based on extension) can be uploaded.
// Env var looks like CURIER_ALLOWED_FILE_EXTENSIONS=jpg;jpeg;md
//
// DO NOT add a '.' for each extension - it will be added automatically.
var allowedFileExtensions = map[string]bool{
".jpg": true,
".jpeg": true,
".webm": true,
".mkv": true,
".mp4": true,
".mp3": true,
".avi": true,
".png": true,
".pdf": true,
".zip": true,
".rar": true,
".tar.gz": true,
".txt": true,
".md": true,
}
Loading