macrdel commited on
Commit
366a813
1 Parent(s): 78f2671

update workflow

Browse files
.github/workflows/deploy.yml CHANGED
@@ -23,9 +23,7 @@ jobs:
23
  password: ${{ secrets.DOCKER_PASSWORD }}
24
 
25
  - name: Run tests
26
- run: |
27
- docker build --target test -t macrdel/sentiment-summarize-youtube-comments-backend:latest .
28
- docker run --rm macrdel/sentiment-summarize-youtube-comments-backend:latest pytest /tests
29
 
30
  - name: Build Docker image
31
  if: success()
 
23
  password: ${{ secrets.DOCKER_PASSWORD }}
24
 
25
  - name: Run tests
26
+ run: docker-compose up tests
 
 
27
 
28
  - name: Build Docker image
29
  if: success()
Dockerfile.Test ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10.5
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
+
9
+ RUN useradd -m -u 1000 user
10
+ USER user
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ WORKDIR $HOME/app
15
+
16
+ COPY --chown=user . $HOME/app
17
+
18
+ CMD ["pytest", "tests"]
docker-compose-ci.yml CHANGED
@@ -45,6 +45,16 @@ services:
45
  networks:
46
  - custom
47
 
 
 
 
 
 
 
 
 
 
 
48
  networks:
49
  custom:
50
  driver: bridge
 
45
  networks:
46
  - custom
47
 
48
+ tests:
49
+ build:
50
+ context: .
51
+ dockerfile: Dockerfile.Test
52
+ volumes:
53
+ - .:/home/user/app
54
+ depends_on:
55
+ - app
56
+ command: pytest tests
57
+
58
  networks:
59
  custom:
60
  driver: bridge