working build

This commit is contained in:
ra_ma
2025-09-20 15:59:45 +01:00
parent 0de342189a
commit 958bd63caf
2 changed files with 37 additions and 14 deletions

View File

@@ -1,14 +1,11 @@
ARG TAG
ARG VERSION=latest
FROM node:latest
# Prep Files
FROM alpine:latest as downloader
WORKDIR /src
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
build-essential \
golang \
&& rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache curl tar wget
# Fetch the latest tag and download the source code
RUN curl -s https://api.github.com/repos/5rahim/seanime/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' > tag.file && \
@@ -18,19 +15,44 @@ RUN curl -s https://api.github.com/repos/5rahim/seanime/releases/latest | grep '
rm ${TAG}.tar.gz tag.file && \
mv seanime-* seanime
# Start web build
FROM node:18-alpine AS frontend-build
# Set working directory to the extracted source code
WORKDIR /seanime
WORKDIR /app/seanime-web
# Copy source from downloader
COPY --from=downloader /src/seanime/seanime-web ./
# Build the web interface
RUN cd seanime-web && \
npm install && \
RUN npm install && \
npm run build && \
mkdir -p ../web && \
mv out/* ../web/
mkdir -p /app/web && \
cp -r out/* /app/web/
# Start backend build
FROM golang:1.24-alpine AS backend-build
# set build root
WORKDIR /build
# Copy needed files from previous stages
COPY --from=downloader /src/seanime /build
COPY --from=frontend-build /app/web /build/web
# Build the server for Linux
RUN go build -o seanime -trimpath -ldflags="-s -w"
# Complete the APP
FROM alpine:latest
# Set root
WORKDIR /app
# Copy preped builds
COPY --from=backend-build /build/seanime .
# Set up the data directory
VOLUME /DATA
@@ -38,4 +60,4 @@ VOLUME /DATA
EXPOSE 43211
# Command to run the server
CMD ["./seanime"]
CMD ["/app/seanime", "--datadir", "/DATA"]