Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 39s
43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
# ---- 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 --no-build-isolation -r requirements.txt
|
|
|
|
# ---- Final Stage ----
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy virtual environment from builder stage
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
|
|
# 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
|
|
EXPOSE 3001
|
|
CMD ["./run_docker.sh"]
|