-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ranger): semi-complete fourm analysis cog
- Loading branch information
1 parent
a6dd3e3
commit 8cc98aa
Showing
2 changed files
with
187 additions
and
42 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
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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
FROM python:3.10.5-slim-buster | ||
RUN apt-get -y update | ||
RUN apt-get -y install git | ||
FROM python:3.11-buster as builder | ||
RUN pip install poetry==1.5.1 | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 | ||
|
||
WORKDIR /venv | ||
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends git | ||
RUN touch README.md | ||
|
||
COPY ["pyproject.toml", "poetry.lock", "./"] | ||
RUN poetry config installer.max-workers 10 | ||
RUN poetry install --no-root --no-cache | ||
|
||
FROM python:3.11-slim-buster as local | ||
|
||
RUN apt-get update && apt-get install libpq5 -y | ||
|
||
WORKDIR /app | ||
RUN useradd --create-home ranger | ||
|
||
# Set environment variables. | ||
# 1. Force Python stdout and stderr streams to be unbuffered. | ||
ENV VIRTUAL_ENV=/venv/.venv | ||
|
||
COPY requirements.txt requirements.txt | ||
RUN pip3 install -r requirements.txt | ||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" | ||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} | ||
|
||
COPY . . | ||
COPY --chown=ranger:ranger ./bot . | ||
|
||
RUN chown -R ranger:ranger /app | ||
USER ranger | ||
|
||
CMD [ "python3", "-m", "bot" ] |