Skip to content

Commit

Permalink
#1 Use pre-defined OS and Python Packages list
Browse files Browse the repository at this point in the history
  • Loading branch information
ajamous committed Sep 14, 2024
1 parent cc3b6b3 commit cc2c3ef
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
# Use Ubuntu 22.04 LTS as the base image
# Use Ubuntu as the base image
FROM ubuntu:22.04

# Set the working directory in the container
WORKDIR /app

# Install Python 3.12, build tools, and required dependencies
# Copy the installed_packages.txt file from the host to the container
COPY installed_packages.txt /app/installed_packages.txt

# Update the package lists and install system-level packages from the host
RUN apt-get update && \
apt-get install -y dselect && \
dpkg --set-selections < /app/installed_packages.txt && \
apt-get dselect-upgrade -y && \
rm -rf /var/lib/apt/lists/*

# Copy the requirements.txt file from the host
COPY requirements.txt /app/requirements.txt

# Install Python 3.12 and create a virtual environment
RUN apt-get update && apt-get install -y \
python3.12 \
python3.12-venv \
build-essential \
cmake \
g++ \
gcc \
python3-dev \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*

# Copy the current directory contents into the container at /app
COPY . /app

# Create the ots virtual environment using Python's built-in venv tool
# Create the Python virtual environment using Python 3.12
RUN python3.12 -m venv /app/ots

# Copy the requirements.txt file
COPY requirements.txt /app/requirements.txt

# Install the dependencies in the ots environment
# Install Python dependencies from requirements.txt
RUN /app/ots/bin/pip install --no-cache-dir --upgrade pip
RUN /app/ots/bin/pip install --no-cache-dir -r /app/requirements.txt

# Copy the rest of the app's code into the container
COPY . /app

# Make the start.sh script executable
RUN chmod +x /app/start.sh

# Expose port 8002
EXPOSE 8002

# Define environment variable
# Set environment variable
ENV PYTHONUNBUFFERED=1

# Run the start script using the ots environment
Expand Down

0 comments on commit cc2c3ef

Please sign in to comment.