From 9df05c30034433952b9d6ac8f28f79e2c8da6811 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 9 Nov 2024 00:52:16 +0500 Subject: [PATCH] build files clean up --- .build/Dockerfile | 36 ----------------------------------- .build/dev/Dockerfile | 8 ++++++++ .build/prod/Dockerfile | 16 ++++++++++++++++ .build/{ => prod}/compose.yml | 5 ++--- compose.yml | 10 ++++++---- 5 files changed, 32 insertions(+), 43 deletions(-) delete mode 100644 .build/Dockerfile create mode 100644 .build/dev/Dockerfile create mode 100644 .build/prod/Dockerfile rename .build/{ => prod}/compose.yml (52%) diff --git a/.build/Dockerfile b/.build/Dockerfile deleted file mode 100644 index 505a144..0000000 --- a/.build/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM python:3.12-slim - -# Set working directory -WORKDIR /app - -# Set environment variables -#ENV PYTHONDONTWRITEBYTECODE=1 \ -# PYTHONUNBUFFERED=1 \ -# STREAMLIT_SERVER_PORT=8501 \ -# STREAMLIT_SERVER_ADDRESS=0.0.0.0 -ARG PYTHONDONTWRITEBYTECODE=1 \ - PYTHONUNBUFFERED=1 \ - STREAMLIT_SERVER_PORT=8501 \ - STREAMLIT_SERVER_ADDRESS=0.0.0.0 - -# Install system dependencies -#RUN apt-get update && \ -# apt-get install -y --no-install-recommends \ -# build-essential \ -# curl \ -# && rm -rf /var/lib/apt/lists/* - -# Copy requirements first to leverage Docker cache -COPY requirements.txt . - -# Install Python dependencies -RUN pip install --no-cache-dir -r requirements.txt - -# Copy the application code -COPY . . - -# Expose the port Streamlit runs on -EXPOSE 8501 - -# Command to run the application -CMD ["streamlit", "run", "app.py"] diff --git a/.build/dev/Dockerfile b/.build/dev/Dockerfile new file mode 100644 index 0000000..3e31cf1 --- /dev/null +++ b/.build/dev/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --no-cache-dir -r requirements.txt + diff --git a/.build/prod/Dockerfile b/.build/prod/Dockerfile new file mode 100644 index 0000000..18f2657 --- /dev/null +++ b/.build/prod/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.12-slim + +WORKDIR /app + +ARG PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + STREAMLIT_SERVER_PORT=8501 \ + STREAMLIT_SERVER_ADDRESS=0.0.0.0 + +COPY requirements.txt . + +RUN pip install --no-cache-dir -r requirements.txt + +COPY app.py . + +CMD streamlit run app.py diff --git a/.build/compose.yml b/.build/prod/compose.yml similarity index 52% rename from .build/compose.yml rename to .build/prod/compose.yml index 29d89b2..d8a0fd5 100644 --- a/.build/compose.yml +++ b/.build/prod/compose.yml @@ -1,7 +1,6 @@ services: mvpost-package-no-finder: build: - context: .. - dockerfile: .build/Dockerfile + context: ../../ + dockerfile: .build/prod/Dockerfile image: git.shihaam.dev/shihaam/mvpost-package-no-finder - container_name: mvpost-package-no-finder diff --git a/compose.yml b/compose.yml index f6051fa..96b366a 100644 --- a/compose.yml +++ b/compose.yml @@ -1,14 +1,16 @@ -version: '3.8' - services: mvpost-package-no-finder: - image: git.shihaam.dev/shihaam/mvpost-package-no-finder + build: + context: . + dockerfile: .build/dev/Dockerfile container_name: mvpost-package-no-finder + hostname: mvpost-package-no-finder ports: - - "8501:8501" + - 8501:8501 volumes: - .:/app environment: - STREAMLIT_SERVER_PORT=8501 - STREAMLIT_SERVER_ADDRESS=0.0.0.0 restart: unless-stopped + command: streamlit run app.py