first build

This commit is contained in:
ra_ma
2025-09-20 13:15:15 +01:00
parent 26348bf358
commit ca62675866

View File

@@ -1,19 +1,27 @@
# Stage 1: Build React/Next.js frontend ARG VERSION=latest
FROM alpine:latest as downloader
WORKDIR /src
RUN apk add --no-cache curl tar
# Download latest release info and extract the version tag
RUN curl -s https://api.github.com/repos/5rahim/seanime/releases/${VERSION} \
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' > /src/tag.txt
RUN TAG=$(cat /src/tag.txt) && \
curl -L https://github.com/5rahim/seanime/archive/refs/tags/${TAG}.tar.gz -o seanime.tar.gz && \
tar -xzvf seanime.tar.gz
FROM node:18-alpine AS frontend-build FROM node:18-alpine AS frontend-build
WORKDIR /app/seanime-web WORKDIR /app/seanime-web
COPY seanime-web ./ COPY --from=downloader /src/seanime*/seanime-web ./
RUN npm install RUN npm install
RUN npm run build RUN npm run build
RUN mkdir -p /app/web && cp -r out/* /app/web/ RUN mkdir -p /app/web && cp -r out/* /app/web/
# Stage 2: Build Go backend
FROM golang:1.23-alpine AS backend-build FROM golang:1.23-alpine AS backend-build
WORKDIR /app WORKDIR /app
COPY . . COPY --from=downloader /src/seanime* ./
COPY --from=frontend-build /app/web ./web COPY --from=frontend-build /app/web ./web
RUN go build -o seanime -trimpath -ldflags="-s -w" RUN go build -o seanime -trimpath -ldflags="-s -w"
# Stage 3: Production container
FROM alpine:latest FROM alpine:latest
WORKDIR /app WORKDIR /app
COPY --from=backend-build /app/seanime . COPY --from=backend-build /app/seanime .