Skip to content

Commit

Permalink
try with different dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
fpgmaas committed Jun 17, 2024
1 parent 1d3de08 commit 4937b1a
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# syntax=docker/dockerfile:1

FROM python:3.10-slim-bookworm
# Builder stage
FROM python:3.10-slim-bookworm as builder

ENV POETRY_VERSION=1.6 \
POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_VERSION=1.6

# Install poetry
# Install dependencies
RUN pip install "poetry==$POETRY_VERSION"

# Copy only requirements to cache them in docker layer
WORKDIR /code
COPY poetry.lock pyproject.toml /code/

# Project initialization:
RUN poetry install --no-interaction --no-ansi --no-root --no-dev
# Install dependencies in a virtual environment
RUN poetry config virtualenvs.create true \
&& poetry install --no-interaction --no-ansi --no-root --no-dev \
&& poetry export -f requirements.txt > requirements.txt

# Copy Python code to the Docker image
COPY pypi_scout /code/pypi_scout/
# Final stage
FROM python:3.10-slim-bookworm

ENV PYTHONPATH=/code
WORKDIR /code

# Install dependencies
COPY --from=builder /code/requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt \
&& rm -rf /root/.cache/pip

# Copy the start script and make executable
# Copy only necessary files
COPY pypi_scout /code/pypi_scout/
COPY start.sh /start.sh
RUN chmod +x /start.sh

# Make empty data directory
RUN chmod +x /start.sh
RUN mkdir -p /code/data

# Use the script as the entrypoint
ENV PYTHONPATH=/code

# Set entrypoint
ENTRYPOINT ["/start.sh"]

0 comments on commit 4937b1a

Please sign in to comment.