2023-10-14 11:52:04 +00:00
|
|
|
# Use an official Python runtime as a parent image
|
2023-10-03 15:50:09 +00:00
|
|
|
FROM python:slim
|
2023-10-14 11:52:04 +00:00
|
|
|
|
|
|
|
# Set the working directory in the container to /app
|
2023-10-03 14:15:17 +00:00
|
|
|
WORKDIR /app
|
2023-10-03 15:29:56 +00:00
|
|
|
|
2023-10-14 11:52:04 +00:00
|
|
|
# Add metadata to the image to describe that the container is listening on port 80
|
2024-01-24 22:12:01 +00:00
|
|
|
EXPOSE 8000
|
2023-10-14 11:52:04 +00:00
|
|
|
|
|
|
|
# Copy the current directory contents into the container at /app
|
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
# Install any needed packages specified in pyproject.toml
|
|
|
|
RUN apt-get update && apt-get install -y gcc curl && \
|
|
|
|
curl -sSL https://install.python-poetry.org | python - && \
|
2023-10-14 11:54:51 +00:00
|
|
|
echo "export PATH=$PATH:/root/.local/bin" >> ~/.bashrc && \
|
|
|
|
. ~/.bashrc && \
|
2023-10-14 11:52:04 +00:00
|
|
|
poetry config virtualenvs.create false && \
|
|
|
|
poetry install --no-dev
|
|
|
|
|
2024-01-25 08:12:19 +00:00
|
|
|
# Run server when the container launches
|
2024-01-25 08:18:29 +00:00
|
|
|
CMD granian --no-ws --host 0.0.0.0 --port 8000 --interface asgi main:app
|