fix merge requets failed Dcokerfiles
This commit is contained in:
@@ -1,13 +1,45 @@
|
|||||||
/credentials.json
|
# Git
|
||||||
/test.py
|
.git
|
||||||
/venv
|
.gitignore
|
||||||
/downloads/
|
.gitattributes
|
||||||
/creds/
|
|
||||||
/Test.py
|
# Docker
|
||||||
/prgs/
|
Dockerfile
|
||||||
/flask_server.log
|
.dockerignore
|
||||||
|
|
||||||
|
# Node
|
||||||
|
node_modules
|
||||||
|
spotizerr-ui/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
.Python
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
.env.example
|
||||||
|
|
||||||
|
# Editor/OS
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
# Application data
|
||||||
|
credentials.json
|
||||||
|
test.py
|
||||||
|
downloads/
|
||||||
|
creds/
|
||||||
|
Test.py
|
||||||
|
prgs/
|
||||||
|
flask_server.log
|
||||||
test.sh
|
test.sh
|
||||||
__pycache__/
|
|
||||||
routes/__pycache__/*
|
routes/__pycache__/*
|
||||||
routes/utils/__pycache__/*
|
routes/utils/__pycache__/*
|
||||||
search_test.py
|
search_test.py
|
||||||
@@ -20,8 +52,5 @@ search_demo.py
|
|||||||
celery_worker.log
|
celery_worker.log
|
||||||
static/js/*
|
static/js/*
|
||||||
logs/
|
logs/
|
||||||
.env.example
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
data
|
data
|
||||||
tests/
|
tests/
|
||||||
58
Dockerfile
58
Dockerfile
@@ -1,27 +1,31 @@
|
|||||||
# Stage 1: TypeScript build
|
# Stage 1: TypeScript to JavaScript compilation
|
||||||
FROM node:22.16.0-slim AS typescript-builder
|
FROM node:22-slim AS typescript-builder
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY tsconfig.json .
|
||||||
# Copy necessary files for TypeScript build
|
|
||||||
COPY tsconfig.json ./tsconfig.json
|
|
||||||
COPY src/js ./src/js
|
COPY src/js ./src/js
|
||||||
|
|
||||||
# Install TypeScript globally
|
|
||||||
RUN npm install -g typescript
|
RUN npm install -g typescript
|
||||||
|
|
||||||
# Compile TypeScript
|
|
||||||
RUN tsc
|
RUN tsc
|
||||||
|
|
||||||
# Stage 2: Final image
|
# Stage 2: Frontend build
|
||||||
FROM python:3.12-slim AS python-builder
|
FROM node:22-slim AS frontend-builder
|
||||||
|
WORKDIR /app/spotizerr-ui
|
||||||
|
RUN npm install -g pnpm
|
||||||
|
COPY spotizerr-ui/package.json spotizerr-ui/pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
COPY spotizerr-ui/. .
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
|
# Stage 3: Final application image
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
# Set an environment variable for non-interactive frontend installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/Xoconoch/spotizerr"
|
LABEL org.opencontainers.image.source="https://github.com/Xoconoch/spotizerr"
|
||||||
|
|
||||||
# Set the working directory in the container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies, including Node.js and npm (for pnpm)
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
gosu \
|
gosu \
|
||||||
@@ -30,29 +34,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install pnpm globally
|
|
||||||
RUN npm install -g pnpm
|
|
||||||
|
|
||||||
# --- Backend Python Dependencies ---
|
|
||||||
# Copy only the requirements file to leverage Docker cache
|
|
||||||
COPY requirements.txt .
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# --- Frontend Node.js Dependencies ---
|
# Copy application code (excluding UI source and TS source)
|
||||||
# Copy package manager files to leverage Docker cache
|
|
||||||
COPY spotizerr-ui/package.json spotizerr-ui/pnpm-lock.yaml ./spotizerr-ui/
|
|
||||||
# Install frontend dependencies
|
|
||||||
RUN cd spotizerr-ui && pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
# --- Application Code & Frontend Build ---
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# Build the frontend application
|
|
||||||
RUN cd spotizerr-ui && pnpm build
|
|
||||||
|
|
||||||
# --- Final Container Setup ---
|
# Copy compiled assets from previous stages
|
||||||
|
COPY --from=typescript-builder /app/static/js ./static/js
|
||||||
|
COPY --from=frontend-builder /app/spotizerr-ui/dist ./spotizerr-ui/dist
|
||||||
|
|
||||||
# Create necessary directories with proper permissions
|
# Create necessary directories with proper permissions
|
||||||
RUN mkdir -p downloads data/config data/creds data/watch data/history logs/tasks && \
|
RUN mkdir -p downloads data/config data/creds data/watch data/history logs/tasks && \
|
||||||
chmod -R 777 downloads data logs
|
chmod -R 777 downloads data logs
|
||||||
@@ -62,5 +54,3 @@ RUN chmod +x entrypoint.sh
|
|||||||
|
|
||||||
# Set entrypoint to our script
|
# Set entrypoint to our script
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
||||||
# No CMD needed as entrypoint.sh handles application startup
|
|
||||||
|
|||||||
Reference in New Issue
Block a user