Skip to content

Commit 89dd261

Browse files
authored
Fix dockerfile (#30)
* Update Dockerfile and docker-compose.yml * Remove version * Formatting
1 parent 3e018bd commit 89dd261

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,31 @@ and best development practices for Python.
1414
### Development features
1515

1616
- Supports `Python 3.9` and higher.
17-
- [`Poetry`](https://python-poetry.org/) as a dependency manager. See configuration in [`pyproject.toml`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/pyproject.toml).
17+
- [`Poetry`](https://python-poetry.org/) as a dependency manager. See configuration
18+
in [`pyproject.toml`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/pyproject.toml).
1819
- Automatic codestyle with [`Ruff formatter`](https://docs.astral.sh/ruff/formatter/)
1920
- Linting with [`ruff`](https://github.com/astral-sh/ruff)
20-
- Type checks with [`mypy`](https://mypy.readthedocs.io), security checks with [`safety`](https://github.com/pyupio/safety).
21+
- Type checks with [`mypy`](https://mypy.readthedocs.io), security checks
22+
with [`safety`](https://github.com/pyupio/safety).
2123
- Dependencies check with [`deptry`](https://deptry.com/)
2224
- Testing with [`pytest`](https://docs.pytest.org/en/latest/) and [`coverage`](https://github.com/nedbat/coveragepy).
2325
- Ready-to-use [`pre-commit`](https://pre-commit.com/) hooks with code-formatting.
24-
- Ready-to-use [`.editorconfig`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.editorconfig), [`.dockerignore`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.dockerignore), and [`.gitignore`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.gitignore).
26+
-
27+
Ready-to-use [`.editorconfig`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.editorconfig), [`.dockerignore`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.dockerignore),
28+
and [`.gitignore`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.gitignore).
2529

2630
### Deployment features
2731

28-
- `Github Actions` with linters and tests in the [workflow](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.github/workflows/%7B%7B%20cookiecutter.package_name%20%7D%7D.yml).
29-
- `Gitlab CI` with linters and tests in the [pipeline](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.gitlab-ci.yml). Click [here](pages/gitlab.md) for detailed overview.
30-
- Ready-to-use [`Makefile`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/Makefile) with formatting, linting, and testing. More details in [makefile-usage](#makefile-usage).
32+
- `Github Actions` with linters and tests in
33+
the [workflow](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.github/workflows/%7B%7B%20cookiecutter.package_name%20%7D%7D.yml).
34+
- `Gitlab CI` with linters and tests in
35+
the [pipeline](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/.gitlab-ci.yml).
36+
Click [here](pages/gitlab.md) for detailed overview.
37+
- Ready-to-use [`Makefile`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/Makefile) with
38+
formatting, linting, and testing. More details in [makefile-usage](#makefile-usage).
3139
- [Dockerfile](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/Dockerfile) for your package.
32-
- [docker-compose.yml](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/docker-compose.yml) for local development in Docker.
40+
- [docker-compose.yml](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/docker-compose.yml) for
41+
local development in Docker.
3342

3443
## How to use it
3544

@@ -92,7 +101,8 @@ By running `make pre-commit-install`. Make sure to set up git first via `git ini
92101
### Makefile usage
93102

94103
[`Makefile`](%7B%7B%20cookiecutter.project_name.lower().replace('%20',%20'-')%20%7D%7D/Makefile)
95-
contains a lot of functions for faster development.
104+
contains a lot of functions
105+
for faster development.
96106

97107
<details>
98108
<summary>1. Download and remove Poetry</summary>

{{ cookiecutter.project_name.lower().replace(' ', '-') }}/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
4040
# BUILDER-BASE
4141
# Used to build deps + create our virtual environment
4242
################################
43-
FROM python-base as builder-base
43+
FROM python-base AS builder-base
4444
RUN apt-get update \
4545
&& apt-get install --no-install-recommends -y \
4646
# deps for installing poetry
@@ -67,7 +67,7 @@ RUN --mount=type=cache,target=/root/.cache \
6767
# DEVELOPMENT
6868
# Image used during development / testing
6969
################################
70-
FROM python-base as development
70+
FROM python-base AS development
7171
WORKDIR $PYSETUP_PATH
7272

7373
# copy in our built poetry + venv
@@ -88,7 +88,7 @@ CMD ["python", "-m", "{{ cookiecutter.package_name }}.example"]
8888
# PRODUCTION
8989
# Final image used for runtime
9090
################################
91-
FROM python-base as production
91+
FROM python-base AS production
9292
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
9393
COPY ./{{ cookiecutter.package_name }} /app/{{ cookiecutter.package_name }}
9494
WORKDIR /app
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
version: "3.9"
21
services:
32
app:
43
build:
54
context: .
65
dockerfile: Dockerfile
7-
image: {{ cookiecutter.project_name.lower().replace(' ', '-') }}:latest
86
volumes:
97
- ./{{ cookiecutter.package_name }}:/app/{{ cookiecutter.package_name }}

{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ split-on-trailing-comma = false
161161

162162
[tool.ruff.lint.pep8-naming]
163163
classmethod-decorators = [
164-
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
165-
"pydantic.validator",
166-
# Allow SQLAlchemy's dynamic decorators, like `@field.expression`, to trigger class method treatment.
167-
"declared_attr",
168-
"expression",
169-
"comparator",
164+
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
165+
"pydantic.validator",
166+
# Allow SQLAlchemy's dynamic decorators, like `@field.expression`, to trigger class method treatment.
167+
"declared_attr",
168+
"expression",
169+
"comparator",
170170
]
171171

172172
[tool.ruff.lint.pycodestyle] # https://docs.astral.sh/ruff/settings/#pycodestyle

0 commit comments

Comments
 (0)