2024-01-13 20:11:40 +00:00
|
|
|
# Step 1: Use an official Python runtime as a parent image
|
|
|
|
FROM python:3.10-slim AS builder
|
2024-01-13 19:51:28 +00:00
|
|
|
|
2024-01-13 19:59:10 +00:00
|
|
|
# Install Docker
|
2024-01-13 19:59:52 +00:00
|
|
|
RUN apt update
|
2024-01-13 19:59:10 +00:00
|
|
|
RUN apt install curl -y
|
2024-08-28 02:35:49 +01:00
|
|
|
RUN curl -sSL https://get.docker.com/ | CHANNEL=stable bash
|
2024-01-13 19:59:10 +00:00
|
|
|
|
2024-01-13 20:11:40 +00:00
|
|
|
# Step 2: Create the final image
|
|
|
|
FROM python:3.10-slim
|
|
|
|
|
2024-01-13 19:51:28 +00:00
|
|
|
# Keeps Python from generating .pyc files in the container
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
# Turns off buffering for easier container logging
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
# Install pip requirements
|
|
|
|
COPY requirements.txt .
|
|
|
|
RUN python -m pip install -r requirements.txt
|
|
|
|
|
2024-01-13 20:11:40 +00:00
|
|
|
# Set the working directory to /app
|
2024-01-13 19:51:28 +00:00
|
|
|
WORKDIR /app
|
2024-01-13 20:11:40 +00:00
|
|
|
|
|
|
|
# Copy the current directory contents into the container at /app
|
2024-01-13 19:51:28 +00:00
|
|
|
COPY . /app
|
|
|
|
|
2024-01-13 20:11:40 +00:00
|
|
|
# Copy Docker binaries from the builder stage
|
|
|
|
COPY --from=builder /usr/bin/docker /usr/bin/docker
|
2024-01-13 20:15:31 +00:00
|
|
|
#COPY --from=builder /usr/lib/docker /usr/lib/docker
|
2024-01-13 20:11:40 +00:00
|
|
|
|
|
|
|
# Set an environment variable with the path to the config file
|
2024-01-13 19:55:54 +00:00
|
|
|
ENV CONFIG_FILE=/app/config.yml
|
2024-01-13 19:51:28 +00:00
|
|
|
|
2024-01-13 20:11:40 +00:00
|
|
|
# Specify the command to run on container start
|
2024-01-13 19:51:28 +00:00
|
|
|
CMD ["python", "src/manage.py"]
|