-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added the option to include a simple Dockerfile
- Loading branch information
Florian Maas
authored
Jun 29, 2022
1 parent
d6eec90
commit cf35530
Showing
11 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
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
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,23 @@ | ||
# Containerization with Docker | ||
|
||
If `dockerfile` is set to `"y"`, a simple `Dockerfile` is added to the | ||
repository. The Dockerfile installs poetry, sets up the environment and runs | ||
`foo.py` when run. | ||
|
||
The docker image can be built with | ||
|
||
```bash | ||
docker build . -t my-docker-image | ||
``` | ||
|
||
It can then be run in the background with | ||
|
||
```bash | ||
docker run -d my-docker-image | ||
``` | ||
|
||
Or, run it interactive mode with | ||
|
||
``` | ||
docker run --rm -it --entrypoint bash my-docker-image | ||
``` |
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
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
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,20 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM python:3.9-slim-buster | ||
|
||
ENV POETRY_VERSION=1.1.13 | ||
|
||
# Install poetry | ||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
# Copy only requirements to cache them in docker layer | ||
WORKDIR /code | ||
COPY poetry.lock pyproject.toml /code/ | ||
|
||
# Project initialization: | ||
RUN poetry config virtualenvs.create false && \poetry install --no-interaction --no-ansi --no-root --no-dev | ||
|
||
# Copy Python code to the Docker image | ||
COPY {{cookiecutter.project_slug}} /code/{{cookiecutter.project_slug}}/ | ||
|
||
CMD [ "python", "{{cookiecutter.project_slug}}/foo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ def foo() -> str: | |
""" | ||
|
||
return "foo" | ||
|
||
|
||
if __name__ == "__main__": | ||
print(foo()) |