non split build to get it working again
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 1m35s

This commit is contained in:
Karl 2025-07-14 14:47:06 +01:00
parent 530461a5f0
commit a28daabe2f

View File

@ -1,43 +1,31 @@
# ---- Builder Stage ----
FROM python:3.11-slim-bookworm as builder
# Install git for fetching git-based dependencies
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
# Create a virtual environment
RUN python -m venv /opt/venv
# Activate the virtual environment
ENV PATH="/opt/venv/bin:$PATH"
# Copy requirements and install dependencies
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir requests==2.32.3
RUN pip install --no-cache-dir stem==1.8.2
RUN pip install --no-cache-dir --no-build-isolation -r requirements.txt
# ---- Final Stage ----
FROM python:3.11-slim-bookworm
# Set working directory
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
libgomp1 \
libgl1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy virtual environment from builder stage
COPY --from=builder /opt/venv /opt/venv
COPY requirements.txt .
RUN pip install --no-cache-dir requests stem
RUN pip install --no-cache-dir git+https://github.com/karl0ss/requests_tor.git@ae1e85abb3bb2c25f431bd031c6d881986c626f6
RUN pip install --no-cache-dir -r requirements.txt
# Activate the virtual environment
ENV PATH="/opt/venv/bin:$PATH"
ENV FLASK_ENV=production
# Copy application code
COPY . .
# Handle versioning
ARG VERSION
RUN if [ -n "$VERSION" ]; then echo $VERSION > VERSION; fi
# Make run script executable and run the application
RUN chmod +x run_docker.sh
ARG VERSION
RUN echo $VERSION > VERSION
EXPOSE 3001
ENV FLASK_ENV=production
RUN chmod +x run_docker.sh
CMD ["./run_docker.sh"]