first build
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -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
|
||||
WORKDIR /app/seanime-web
|
||||
COPY seanime-web ./
|
||||
COPY --from=downloader /src/seanime*/seanime-web ./
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
RUN mkdir -p /app/web && cp -r out/* /app/web/
|
||||
|
||||
# Stage 2: Build Go backend
|
||||
FROM golang:1.23-alpine AS backend-build
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=downloader /src/seanime* ./
|
||||
COPY --from=frontend-build /app/web ./web
|
||||
RUN go build -o seanime -trimpath -ldflags="-s -w"
|
||||
|
||||
# Stage 3: Production container
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=backend-build /app/seanime .
|
||||
|
||||
Reference in New Issue
Block a user