| 1 |
# Use a base image with necessary build tools |
| 2 |
FROM python:3.11-slim AS builder |
| 3 |
|
| 4 |
# Install required packages for building |
| 5 |
RUN apt-get update && apt-get install -y \ |
| 6 |
gcc \ |
| 7 |
musl-dev \ |
| 8 |
build-essential \ |
| 9 |
python3-dev \ |
| 10 |
&& apt-get clean \ |
| 11 |
&& rm -rf /var/lib/apt/lists/* |
| 12 |
|
| 13 |
# Set the working directory |
| 14 |
WORKDIR /app |
| 15 |
|
| 16 |
# Copy the application code |
| 17 |
COPY . . |
| 18 |
|
| 19 |
# Install PyInstaller |
| 20 |
RUN pip install pyinstaller |
| 21 |
RUN pip install -r requirements.txt |
| 22 |
|
| 23 |
# Create a binary with PyInstaller |
| 24 |
RUN pyinstaller --onefile --clean podman_compose.py |
| 25 |
|
| 26 |
# Create /result dir in case it is not mounted |
| 27 |
RUN mkdir -p /result |
| 28 |
|
| 29 |
# Export binary |
| 30 |
RUN cp /app/dist/podman_compose /result/podman-compose |