-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example Docker file and docker compose files, and suggested usages
- Loading branch information
1 parent
c338500
commit c7a8faf
Showing
3 changed files
with
32 additions
and
1 deletion.
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,2 +1,8 @@ | ||
# python-poetry-base | ||
A base Dockerfile with poetry pre-installed | ||
A base Dockerfile with poetry pre-installed. Using this image as a base will allow you to forget about anything required to setup poetry within your Docker environment. | ||
|
||
Simply `COPY` your pyproject & poetry lock file into your image, and `poetry install`. | ||
|
||
virtual environments are created in `/opt/poetry/home` as to not conflict with in-project `.venv` folders that may be copied into the image if using a docker compose source code volume. | ||
|
||
See the [examples](./examples/) folder for example usage. |
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,12 @@ | ||
FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:3-slim | ||
|
||
# Install project dependencies | ||
WORKDIR /my-app | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN poetry install | ||
|
||
# Copy the source code in last to optimize rebuilding the image | ||
COPY . . | ||
|
||
ENTRYPOINT ["poetry"] | ||
CMD ["run", "python", "-m", "app"] |
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,13 @@ | ||
bot: | ||
restart: unless-stopped | ||
build: . | ||
volumes: | ||
- .:/app:ro | ||
# Thanks to POETRY_HOME being set to "/opt/poetry/home", | ||
# any venv folders on the host file system at this path | ||
# will not be used by poetry within the Docker environment. | ||
tty: true | ||
env_file: | ||
- .env | ||
environment: | ||
FOO: "bar" |