36 lines
1.1 KiB
Docker
36 lines
1.1 KiB
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.9-slim
|
|
|
|
# Install git
|
|
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install Python packages
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Build-time arguments for git configuration and remote repository URL.
|
|
# These can be passed in from the .env file or as build arguments.
|
|
ARG GIT_USER
|
|
ARG GIT_EMAIL
|
|
ARG GIT_REMOTE
|
|
|
|
# Configure git with the provided user credentials
|
|
RUN git config --global user.name "${GIT_USER}" && \
|
|
git config --global user.email "${GIT_EMAIL}"
|
|
|
|
# Clone the repository using the provided remote URL (includes credentials if needed)
|
|
# This will clone the repo into the current working directory (/app)
|
|
RUN mkdir software
|
|
RUN git clone ${GIT_REMOTE} software
|
|
|
|
# Copy the rest of the application code into the container (if not already cloned)
|
|
COPY . .
|
|
|
|
# Expose port 5000 for the Flask app
|
|
EXPOSE 9776
|
|
|
|
# Start the Flask app
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:9776", "app:app"] |