Skip to content

Commit ba6ffc1

Browse files
author
test
committed
docs: Add development setup and Docker build instructions to README, update config examples, and fix relative links.
1 parent 5926bdf commit ba6ffc1

3 files changed

Lines changed: 100 additions & 7 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
tags: [ 'v*.*.*' ]
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log into registry ${{ env.REGISTRY }}
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract Docker metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
46+
type=semver,pattern={{version}}
47+
type=sha
48+
49+
- name: Build and push Docker image
50+
id: build-and-push
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
platforms: linux/amd64,linux/arm64
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1-
ARG BUN_VERSION=1.2.21
2-
3-
FROM oven/bun:${BUN_VERSION}-alpine AS base
1+
# -- Build Stage --
2+
FROM oven/bun:1.2-alpine AS build
43
WORKDIR /app
54

6-
COPY package.json bun.lock* tsconfig.json ./
5+
# Copy dependency manifests
6+
COPY package.json bun.lock* ./
77

8-
RUN bun install --production --frozen-lockfile
8+
# Install ALL dependencies (including devDependencies for testing/build)
9+
RUN bun install --frozen-lockfile
910

11+
# Copy the rest of the source
1012
COPY . .
1113

14+
# -- Final Stage --
15+
FROM oven/bun:1.2-alpine AS release
16+
WORKDIR /app
17+
18+
# Copy production dependencies only
19+
COPY --from=build /app/package.json /app/bun.lock* ./
20+
RUN bun install --production --frozen-lockfile
21+
22+
# Copy the source code
23+
COPY --from=build /app/src ./src
24+
25+
# Create logs and config directories with correct permissions
26+
RUN mkdir -p /logs /config && \
27+
chown -R bun:bun /logs /config /app
28+
29+
# Use the non-root user 'bun' provided by the base image
30+
USER bun
31+
1232
EXPOSE 8481
1333

14-
VOLUME /logs
15-
VOLUME /config
34+
# Persist logs and config
35+
VOLUME ["/logs", "/config"]
1636

37+
# Start the application
1738
CMD ["bun", "run", "src/main.ts", "/logs", "/config/config.yaml"]

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
redirecterr:
3+
image: ghcr.io/${GITHUB_REPOSITORY_OWNER}/redirecterr:latest
4+
container_name: redirecterr
5+
restart: unless-stopped
6+
ports:
7+
- 8481:8481
8+
volumes:
9+
- ./config:/config
10+
- ./logs:/logs
11+
environment:
12+
- LOG_LEVEL=info
13+
- TZ=UTC

0 commit comments

Comments
 (0)