mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 21:54:00 +02:00
combine Dockerfiles of backend and frontend
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -1,22 +1,39 @@
|
||||
FROM node:24-alpine AS frontend-build
|
||||
WORKDIR /frontend
|
||||
ARG VERSION
|
||||
ARG BASE_PATH=""
|
||||
|
||||
COPY web/package*.json ./
|
||||
RUN npm ci --production && npm cache clean --force
|
||||
|
||||
COPY web/ ./
|
||||
RUN env PUBLIC_VERSION=${VERSION} PUBLIC_API_URL=${BASE_PATH}/api/v1 BASE_PATH=${BASE_PATH}/web npm run build
|
||||
|
||||
FROM ghcr.io/astral-sh/uv:debian-slim
|
||||
ARG VERSION
|
||||
ARG BASE_PATH=""
|
||||
LABEL author="github.com/maxdorninger"
|
||||
LABEL version=${VERSION}
|
||||
LABEL description="Docker image for the backend of MediaManager"
|
||||
LABEL description="Docker image for MediaManager"
|
||||
|
||||
ENV MISC__IMAGE_DIRECTORY=/data/images \
|
||||
MISC__TV_DIRECTORY=/data/tv \
|
||||
MISC__MOVIE_DIRECTORY=/data/movies \
|
||||
MISC__TORRENT_DIRECTORY=/data/torrents \
|
||||
PUBLIC_VERSION=${VERSION} \
|
||||
MISC__API_BASE_PATH="/api/v1" \
|
||||
CONFIG_FILE="/app/config.toml"
|
||||
CONFIG_FILE="/app/config.toml"\
|
||||
BASE_PATH=${BASE_PATH}\
|
||||
FRONTEND_FILES_DIR="/app/web/build"
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates gcc mime-support curl gzip unzip tar 7zip bzip2 unar
|
||||
apt-get install -y ca-certificates gcc mime-support curl gzip unzip tar 7zip bzip2 unar && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
|
||||
RUN uv sync --locked
|
||||
|
||||
COPY --chmod=755 mediamanager-backend-startup.sh .
|
||||
@@ -24,6 +41,8 @@ COPY media_manager ./media_manager
|
||||
COPY alembic ./alembic
|
||||
COPY alembic.ini .
|
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:8000${MISC__API_BASE_PATH}/health || exit 1
|
||||
COPY --from=frontend-build /frontend/build /app/web/build
|
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:8000${BASE_PATH}/api/v1/health || exit 1
|
||||
EXPOSE 8000
|
||||
CMD ["/app/mediamanager-backend-startup.sh"]
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
ARG VERSION
|
||||
ARG BASE_URL=""
|
||||
FROM node:24-alpine AS build
|
||||
WORKDIR /app
|
||||
ARG VERSION
|
||||
ARG BASE_URL
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm ci && npm cache clean --force
|
||||
|
||||
COPY . .
|
||||
RUN env PUBLIC_VERSION=${VERSION} BASE_URL=${BASE_URL} npm run build
|
||||
|
||||
FROM node:24-alpine AS frontend
|
||||
ARG VERSION
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
LABEL version=${VERSION}
|
||||
LABEL description="Docker image for the web frontend of MediaManager"
|
||||
|
||||
ENV PUBLIC_VERSION=${VERSION}
|
||||
ENV PUBLIC_SSR_WEB=false
|
||||
|
||||
COPY --from=build /app/build ./build
|
||||
COPY --from=build /app/package*.json ./
|
||||
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
EXPOSE 3000
|
||||
USER node
|
||||
CMD ["node","build/index.js"]
|
||||
Reference in New Issue
Block a user