Skip to content

Commit 3f8ebcb

Browse files
committed
Added Docker support and fix typo in README.txt
1 parent 72cb474 commit 3f8ebcb

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM python:3.8.3-slim-buster
2+
3+
RUN adduser --system user
4+
5+
WORKDIR /home/user/app
6+
7+
RUN apt-get update && \
8+
apt-get install -y git && \
9+
chown user /home/user/app && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
USER user
13+
14+
ENV PATH /home/user/.local/bin:${PATH}
15+
16+
COPY src src
17+
COPY tests tests
18+
COPY noxfile.py .
19+
COPY pyproject.toml .
20+
COPY poetry.lock .
21+
COPY .pre-commit-config.yaml .
22+
COPY .gitignore .
23+
COPY .flake8 .
24+
25+
RUN pip install nox --user && \
26+
nox -s install
27+
28+
CMD ["nox", "-s", "run"]

{{cookiecutter.project_slug}}/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ This Project depends on the following projects.
116116
```sh
117117
pip install --user --upgrade nox
118118
```
119-
3. Install pre-commit and poetry
119+
3. Install pre-commit and poetry
120120
```sh
121121
nox -s install
122122
```

{{cookiecutter.project_slug}}/noxfile.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,38 @@
55

66
import nox
77

8-
nox.options.sessions = ["install", "pre-commit"]
8+
nox.options.sessions = ["install-dev", "pre-commit"]
9+
10+
11+
@nox.session(python=False, name="run")
12+
def run(session):
13+
"""Run the project main module."""
14+
session.run(
15+
"poetry",
16+
"run",
17+
"python",
18+
"-m",
19+
"{{cookiecutter.package_name}}.{{cookiecutter.module_name}}",
20+
)
21+
22+
23+
@nox.session(python=False, name="install-poetry")
24+
def install_poetry(session):
25+
"""Install poetry."""
26+
session.run("pip", "install", "poetry")
927

1028

1129
@nox.session(python=False, name="install")
1230
def install(session):
13-
"""Install project dependencies."""
14-
session.run("pip", "install", "poetry")
31+
"""Install project itself."""
32+
install_poetry(session)
33+
session.run("poetry", "install", "--no-dev")
34+
35+
36+
@nox.session(python=False, name="install-dev")
37+
def install_dev(session):
38+
"""Install project dependencies for development."""
39+
install_poetry(session)
1540
session.run("poetry", "install")
1641
session.run("git", "init")
1742
session.run(

0 commit comments

Comments
 (0)