-
Notifications
You must be signed in to change notification settings - Fork 18
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 #29 from mickdekkers/feat/docker-image
Add Dockerfile for usage with Docker
- Loading branch information
Showing
3 changed files
with
71 additions
and
20 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,31 @@ | ||
FROM python:3.10-alpine | ||
|
||
WORKDIR /app | ||
|
||
# Install build dependencies (gcc, etc.) | ||
RUN apk update \ | ||
&& apk --no-cache --update add build-base libffi-dev openssl-dev | ||
|
||
# Set poetry version to use | ||
ARG POETRY_VERSION=1.4.0 | ||
# Prevent Python from generating .pyc files | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
# Turn off stdout/stderr buffering to make output appear in real time | ||
ENV PYTHONUNBUFFERED 1 | ||
# Set pip env vars for faster/leaner docker builds | ||
ENV PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_NO_CACHE_DIR=1 | ||
|
||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
# Install dependencies first to leverage Docker layer caching | ||
ADD poetry.lock pyproject.toml ./ | ||
|
||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi | ||
|
||
# After dependencies are installed, copy the rest of the code | ||
ADD . . | ||
|
||
ENTRYPOINT ["python", "main.py"] |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from ghtopdep.ghtopdep import cli | ||
|
||
if __name__ == "__main__": | ||
cli(prog_name="ghtopdep") |