Skip to content

Commit

Permalink
Merge pull request #134 from Mrton0121/main
Browse files Browse the repository at this point in the history
feat: optimize Dockerfile, create docker-compose with build
  • Loading branch information
gyptazy authored Jan 24, 2025
2 parents 37bb226 + 8d8fd51 commit 94df2fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
21 changes: 4 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
# Use the official Debian 12 base image
FROM debian:12
# Use the official Python 3.12 image
FROM python:3.12

# Labels
LABEL maintainer="gyptazy@gyptazy.ch"
LABEL org.label-schema.schema-version="0.9"
LABEL org.label-schema.description="ProxLB - Rebalance VM workloads across nodes in a Proxmox cluster."
LABEL org.label-schema.url="https://github.com/gyptazy/ProxLB"

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

# Install python3 and python3-venv
RUN apt-get update && \
apt-get install -y python3 python3-pip python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Create a directory for the app
WORKDIR /app

# Copy the python program from the current directory to /app
COPY proxlb /app/proxlb

# Create a virtual environment
RUN python3 -m venv venv

# Copy requirements to the container
COPY requirements.txt /app/requirements.txt

# Install dependencies in the virtual environment
RUN . venv/bin/activate && pip install -r /app/requirements.txt
RUN pip install -r /app/requirements.txt

# Set the entry point to use the virtual environment's python
ENTRYPOINT ["/app/venv/bin/python3", "/app/proxlb"]
ENTRYPOINT ["python3", "/app/proxlb"]
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
proxlb:
build: .
volumes:
- ./proxlb.conf:/etc/proxlb/proxlb.conf
restart: unless-stopped
container_name: proxlb

0 comments on commit 94df2fd

Please sign in to comment.