Skip to content

Commit cede31c

Browse files
Merge pull request #6 from aleyipsoftwire/exercise-7
Exercise 7
2 parents 3eb21e5 + 7a9338e commit cede31c

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.github/workflows/my-pipeline.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'ansible'
7+
- 'README.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'ansible'
11+
- 'README.md'
12+
13+
jobs:
14+
build:
15+
name: Build and test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- run: docker build --target test --tag todo-app:test .
20+
- run: docker run --env-file .env.test todo-app:test

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ COPY todo_app /app/todo_app
1818

1919
EXPOSE 8000
2020

21+
FROM base as test
22+
23+
ENTRYPOINT poetry run pytest
24+
2125
FROM base as production
2226

2327
ENV FLASK_DEBUG=false

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ docker run -dit \
114114
todo-app:dev
115115
```
116116

117+
Run tests:
118+
```bash
119+
docker build --target test --tag todo-app:test .
120+
docker run -it \
121+
--env-file .env.test \
122+
todo-app:test
123+
```
124+
117125
Run the project in production environment:
118126
```bash
119127
docker build --target production --tag todo-app:prod .

0 commit comments

Comments
 (0)