-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd59cca
commit 83858ed
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM python:3.11-alpine | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
POETRY_VERSION=1.8.0 \ | ||
FLASK_ENV=production \ | ||
PYTHONPATH=/prevent | ||
|
||
# Installing required linux packages + poetry | ||
RUN apk update && \ | ||
apk add gcc libpq-dev curl && \ | ||
rm -rf /var/cache/apk/* && \ | ||
curl -sSL https://install.python-poetry.org | python3 - && \ | ||
# Default Alpine PATH doesn't include /root/.local/bin/ | ||
ln -s /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
||
WORKDIR /prevent | ||
|
||
# Copying the source code of prevent to image | ||
COPY ./src /prevent/src | ||
COPY ./setup /prevent/setup | ||
COPY ./pyproject.toml /prevent/pyproject.toml | ||
|
||
# Install project dependencies with Poetry | ||
RUN poetry install --no-interaction --no-dev | ||
|
||
EXPOSE 8080 | ||
|
||
# Run setup.py from the ./setup directory | ||
RUN python -m setup.setup_container | ||
|
||
# Run the prevent application | ||
CMD ["poetry", "run", "gunicorn", "--bind", "0.0.0.0:8080", "src.app:app"] |