feat: updated Dockerfile and began adding CI/CD for build and deploy
Some checks are pending
Docker / build (push) Waiting to run
Some checks are pending
Docker / build (push) Waiting to run
This commit is contained in:
parent
4b2818ef5f
commit
a93051bae2
2 changed files with 92 additions and 24 deletions
58
.forgejo/workflows/build_and_deploy.yaml
Normal file
58
.forgejo/workflows/build_and_deploy.yaml
Normal file
|
@ -0,0 +1,58 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Build the image daily
|
||||
- cron: '30 21 * * *'
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
REGISTRY: forgejoever.homelab0ne.xyz
|
||||
IMAGE_NAME: joeverfin
|
||||
TAG: latest
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ forgejo.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
${{ env.TAG }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: ${{ forgejo.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
58
Dockerfile
58
Dockerfile
|
@ -1,40 +1,23 @@
|
|||
FROM alpine:latest
|
||||
FROM alpine:latest AS build
|
||||
|
||||
# Install dependencies
|
||||
RUN apk --no-cache add -u -f \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
git \
|
||||
debhelper \
|
||||
gnupg \
|
||||
devscripts \
|
||||
build-essential \
|
||||
mmv \
|
||||
lsb-release \
|
||||
zip \
|
||||
libssl*.* \
|
||||
liblttng-ust*\
|
||||
libssl-dev \
|
||||
libfontconfig*-dev \
|
||||
libcurl*openssl-dev \
|
||||
libfreetype-dev \
|
||||
dotnet8-sdk \
|
||||
nodejs \
|
||||
npm \
|
||||
dotnet9-sdk \
|
||||
nodejs \
|
||||
npm \
|
||||
ffmpeg
|
||||
|
||||
# Fetch jellyfin and jellyfin-web
|
||||
|
||||
WORKDIR /home/root
|
||||
RUN git clone https://github.com/jellyfin/jellyfin.git
|
||||
RUN mv jellyfin jellyfin-server
|
||||
RUN git clone https://github.com/jellyfin/jellyfin-web.git
|
||||
|
||||
# Patch jellyfin-server
|
||||
|
||||
RUN sed -i '/^\s*NetworkChange\.Network/d' jellyfin-server/src/Jellyfin.Networking/Manager/NetworkManager.cs
|
||||
RUN dotnet publish jellyfin-server/Jellyfin.Server --configuration Release --self-contained --runtime linux-amd64 --output /home/root/dist/ -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=true
|
||||
RUN dotnet publish jellyfin-server/Jellyfin.Server --configuration Release --self-contained --runtime linux-musl-x64 --output /home/root/dist/jellyfin -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=true
|
||||
|
||||
# Build jellyfin-web
|
||||
WORKDIR /home/root/jellyfin-web
|
||||
|
@ -42,9 +25,36 @@ RUN npm ci --no-audit --unsafe-perm
|
|||
RUN npm run build:production
|
||||
|
||||
WORKDIR /home/root
|
||||
RUN mv /home/root/jellyfin-web/dist /home/root/dist/jellyfin/jellyfin-web
|
||||
RUN mv /home/root/dist/jellyfin /jellyfin
|
||||
RUN mv /home/root/jellyfin-web/dist /jellyfin/jellyfin-web
|
||||
|
||||
# Add minimal dependencies
|
||||
FROM alpine:latest AS runtime
|
||||
|
||||
ENTRYPOINT ["/home/root/dist/jellyfin/jellyfin"]
|
||||
RUN apk --no-cache add -u -f \
|
||||
ffmpeg \
|
||||
icu-libs \
|
||||
icu-data-full \
|
||||
libstdc++ \
|
||||
libstdc++6
|
||||
|
||||
# Add hardened_malloc
|
||||
COPY --from=ghcr.io/polarix-containers/hardened_malloc:latest /install /usr/local/lib/
|
||||
ENV LD_PRELOAD="/usr/local/lib/libhardened_malloc.so"
|
||||
|
||||
# Default environment variables for the Jellyfin invocation
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
LC_ALL="en_US.UTF-8" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US:en" \
|
||||
JELLYFIN_DATA_DIR="/config" \
|
||||
JELLYFIN_CACHE_DIR="/cache" \
|
||||
JELLYFIN_CONFIG_DIR="/config/config" \
|
||||
JELLYFIN_LOG_DIR="/config/log" \
|
||||
JELLYFIN_WEB_DIR="/jellyfin/jellyfin-web" \
|
||||
JELLYFIN_FFMPEG="/usr/bin/ffmpeg"
|
||||
# JELLYFIN_FFMPEG="/usr/lib/jellyfin-ffmpeg/ffmpeg"
|
||||
COPY --from=build /jellyfin /jellyfin
|
||||
COPY --from=build /jellyfin/jellyfin-web /jellyfin/jellyfin-web
|
||||
|
||||
ENTRYPOINT ["/jellyfin/jellyfin"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue