Skip to content

Commit 7095c1d

Browse files
author
Eric Lopes
committed
Merge pull request 'improve-dockerfile' (#7) from improve-dockerfile into main
Merging with the issue because it's on workflow side, not the main code. Issue created at: https://gitea.eol.myds.me/cluster-projects/python-project-template/issues/8 Reviewed-on: https://gitea.eol.myds.me/cluster-projects/python-project-template/pulls/7
2 parents 001bc2a + 573b4a4 commit 7095c1d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/docker-image.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- name: Install dependencies
1818
run: |
19-
apt-get update && apt-get install -y python3-pip
19+
apt-get update && apt-get install -y python3-pip docker-compose
2020
pip3 install cookiecutter
2121
- name: Generate project files with cookiecutter
2222
run: cookiecutter --no-input .
23-
- name: Build the Docker image
24-
run: cd python-project-example && docker build . --file Dockerfile --tag my-image-name:$(date +%s)
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Build and test
26+
uses: docker/build-push-action@v5
27+
with:
28+
context: ./python-project-example
29+
file: ./Dockerfile
30+
push: false
31+

{{cookiecutter.project_slug}}/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,5 @@ COPY --chown=user:user --from=test /home/user/app/dist dist
4040
RUN pip install --no-cache -r requirements.txt dist/*.whl --user
4141

4242

43-
ENTRYPOINT ["python", "-m"]
44-
CMD ["{{cookiecutter.package_name}}.{{cookiecutter.module_name}}"]
43+
ENTRYPOINT ["python", "-m", "{{cookiecutter.package_name}}.{{cookiecutter.module_name}}"]
4544

{{cookiecutter.project_slug}}/tests/{{cookiecutter.package_name}}_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ def test_divide_error(
100100

101101

102102
def test_basics() -> None:
103-
"""A test that is always True.
104-
"""
103+
"""A test that is always True."""
105104
assert True is True
106105

107106
{% endif %}

0 commit comments

Comments
 (0)