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

1
.gitignore vendored
View File

@@ -167,3 +167,4 @@ go.work.sum
seanime-*/ seanime-*/
tag.file tag.file
v*.tar.gz v*.tar.gz
DATA/

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 # Install dependencies
RUN apt-get update && apt-get install -y \ RUN apk add --no-cache curl tar wget
curl \
wget \
build-essential \
golang \
&& rm -rf /var/lib/apt/lists/*
# Fetch the latest tag and download the source code # 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 && \ 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 && \ rm ${TAG}.tar.gz tag.file && \
mv seanime-* seanime mv seanime-* seanime
# Start web build
FROM node:18-alpine AS frontend-build
# Set working directory to the extracted source code # 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 # Build the web interface
RUN cd seanime-web && \ RUN npm install && \
npm install && \
npm run build && \ npm run build && \
mkdir -p ../web && \ mkdir -p /app/web && \
mv out/* ../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 # Build the server for Linux
RUN go build -o seanime -trimpath -ldflags="-s -w" 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 # Set up the data directory
VOLUME /DATA VOLUME /DATA
@@ -38,4 +60,4 @@ VOLUME /DATA
EXPOSE 43211 EXPOSE 43211
# Command to run the server # Command to run the server
CMD ["./seanime"] CMD ["/app/seanime", "--datadir", "/DATA"]