-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from 8ball030/feat/docker
Feat/docker
- Loading branch information
Showing
4 changed files
with
51 additions
and
14 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 |
---|---|---|
@@ -1,16 +1,32 @@ | ||
FROM python:3.11.1 | ||
WORKDIR /app | ||
FROM python:3.10 as base | ||
ENV VIRTUAL_ENV=/opt/venv | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y cron \ | ||
--no-install-recommends && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
pip install poetry==1.3.2 --no-cache-dir | ||
RUN apt-get update -y && apt-get install gcc -y && rm -rf /var/lib/apt/lists/* | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
RUN pip install -U poetry pip setuptools | ||
|
||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true | ||
COPY pyproject.toml ./ | ||
RUN poetry install --only main | ||
ENV PATH="/APP/.venv/bin:$PATH" | ||
WORKDIR /workdir | ||
COPY pyproject.toml /workdir | ||
COPY poetry.lock /workdir | ||
RUN chown -R $(whoami):$(whoami) /workdir | ||
|
||
RUN poetry install --no-interaction | ||
RUN poetry run apt-get update && apt-get install make git -y | ||
|
||
# Customize base image with agent deps | ||
FROM python:3.10-slim-bullseye | ||
ENV VIRTUAL_ENV=/opt/venv | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
COPY --from=base $VIRTUAL_ENV $VIRTUAL_ENV | ||
RUN apt-get update -y && apt-get install gcc make -y && rm -rf /var/lib/apt/lists/* | ||
ENV VIRTUAL_ENV=/opt/venv | ||
# now we copy deps to be removed in later stages removed later | ||
WORKDIR /workdir | ||
COPY . . | ||
ENV PYTHONPATH=. | ||
ENTRYPOINT ["/opt/venv/bin/poetry"] | ||
CMD ["run", "pytest", "tests"] | ||
|
||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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