Updates to pages
This commit is contained in:
57
docker/Dockerfile
Normal file
57
docker/Dockerfile
Normal file
@@ -0,0 +1,57 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# =========
|
||||
# Builder
|
||||
# =========
|
||||
FROM rust:1.87-slim-bookworm AS builder
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/usr/local/cargo/git,sharing=locked \
|
||||
--mount=type=cache,target=/app/target,sharing=locked \
|
||||
cargo build --release --bin siren && \
|
||||
cp /app/target/release/siren /siren
|
||||
|
||||
# ==========
|
||||
# Packages
|
||||
# ==========
|
||||
FROM debian:bookworm-slim AS packages
|
||||
WORKDIR /packages
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN apt-get update && apt-get install -y python3 curl tar xz-utils && \
|
||||
# Download the platform-independent yt-dlp binary
|
||||
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp > yt-dlp && \
|
||||
# Make yt-dlp executable
|
||||
chmod +x yt-dlp && \
|
||||
# Install ffmpeg for media conversions
|
||||
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
||||
elif [ "$TARGETPLATFORM" = "linux/x86_64" ] || [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
||||
fi
|
||||
|
||||
# =========
|
||||
# Runtime
|
||||
# =========
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
WORKDIR /siren
|
||||
USER root
|
||||
|
||||
COPY --from=builder /siren /usr/local/bin/siren
|
||||
COPY --from=packages /packages/yt-dlp /usr/bin/yt-dlp
|
||||
COPY --from=packages /packages/ffmpeg /usr/bin/ffmpeg
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libc6 \
|
||||
libc6-dev \
|
||||
libopus-dev \
|
||||
libpq5 \
|
||||
libpq-dev \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
CMD ["siren"]
|
||||
30
docker/Dockerfile.ui
Normal file
30
docker/Dockerfile.ui
Normal file
@@ -0,0 +1,30 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# =========
|
||||
# Builder
|
||||
# =========
|
||||
FROM node:lts-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first (better layer caching)
|
||||
COPY ui/package.json ui/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the UI source and build
|
||||
COPY ui/ ./
|
||||
RUN npm run build
|
||||
|
||||
# =========
|
||||
# Runtime
|
||||
# =========
|
||||
FROM nginx:alpine AS runtime
|
||||
|
||||
# Replace the default nginx config with our custom one
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy the built assets from the builder stage
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
73
docker/docker-compose.yml
Normal file
73
docker/docker-compose.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
x-env_file: &env
|
||||
- path: ../.env
|
||||
required: true
|
||||
|
||||
x-restart: &default_restart
|
||||
restart: unless-stopped
|
||||
|
||||
name: siren
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
image: siren:${SIREN_VERSION:-latest}
|
||||
container_name: siren-app
|
||||
env_file: *env
|
||||
environment:
|
||||
DATABASE_HOST: siren-postgres
|
||||
DATABASE_PORT: 5432
|
||||
VALKEY_HOST: siren-valkey
|
||||
VALKEY_PORT: 6379
|
||||
DATA_DIR_PATH: /data
|
||||
volumes:
|
||||
- ${DATA_DIR_PATH:-../data}:/data
|
||||
depends_on:
|
||||
- postgres
|
||||
profiles:
|
||||
- app
|
||||
<<: *default_restart
|
||||
|
||||
ui:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.ui
|
||||
image: siren-ui:${SIREN_VERSION:-latest}
|
||||
container_name: siren-ui
|
||||
ports:
|
||||
- ${UI_PORT:-80}:80
|
||||
depends_on:
|
||||
- app
|
||||
profiles:
|
||||
- ui
|
||||
<<: *default_restart
|
||||
|
||||
postgres:
|
||||
image: postgres:18.0
|
||||
container_name: siren-postgres
|
||||
env_file: *env
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
PGDATA: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
- postgres_logs:/var/log
|
||||
ports:
|
||||
- ${DATABASE_PORT:-5432}:5432
|
||||
<<: *default_restart
|
||||
|
||||
valkey:
|
||||
image: valkey/valkey:9.0.0
|
||||
container_name: siren-valkey
|
||||
volumes:
|
||||
- valkey:/data
|
||||
ports:
|
||||
- ${VALKEY_PORT:-6379}:6379
|
||||
<<: *default_restart
|
||||
|
||||
volumes:
|
||||
postgres:
|
||||
postgres_logs:
|
||||
valkey:
|
||||
32
docker/nginx.conf
Normal file
32
docker/nginx.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Proxy API requests to the backend
|
||||
location /api/ {
|
||||
proxy_pass http://siren-app:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
# Serve the React SPA — fall back to index.html for client-side routing
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user