Skip to content

Commit 7b528a7

Browse files
committed
change workflow
1 parent 8630533 commit 7b528a7

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

.github/workflows/US1.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,37 @@ on:
1515

1616
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1717
jobs:
18-
# This workflow contains a single job called "build-and-deploy:"
19-
build-and-deploy:
20-
# The type of runner that the job will run on
18+
build:
2119
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
2222

23-
# Steps represent a sequence of tasks that will be executed as part of the job
23+
- name: Build Docker Image
24+
run: docker build -t mealplan:staging .
25+
26+
- name: Run Tests
27+
run: |
28+
echo "Running tests..."
29+
# Replace with your actual test command, e.g. pytest, npm test, etc.
30+
echo "Tests passed!"
31+
32+
deploy:
33+
runs-on: ubuntu-latest
34+
needs: build
2435
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2636
- uses: actions/checkout@v4
2737

28-
- name: Docker
38+
- name: Deploy to Staging
2939
run: |
30-
docker build -t mealplan:staging .
31-
echo "Stoppe alte Container falls vorhanden..."
40+
echo "Stopping old containers..."
3241
docker compose down || true
33-
echo "Starte neue Container..."
42+
echo "Starting new containers..."
3443
docker compose up -d --force-recreate
35-
echo "Deployment abgeschlossen"
36-
docker compose logs --tail=50
44+
echo "Deployment finished"
45+
docker logs webserver > deployment.log
46+
47+
- name: Upload Deployment Logs
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: deployment-logs
51+
path: deployment.log

docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
services:
22
app:
3-
image: mealplan:staging
3+
container_name: webserver
4+
image: mealplan:v1
45
ports:
56
- 80:80
67
volumes:

dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ WORKDIR /var/www/html/
2222

2323
COPY . /var/www/html/
2424

25-
RUN rm -f dockerfile
26-
RUN rm -f docker-compose.yaml
27-
RUN rm -f 01_webt-adv-ci-cd-mit-github.pdf
25+
RUN rm dockerfile
26+
RUN rm docker-compose.yaml
27+
RUN rm 01_webt-core-docker.md
2828
RUN composer install
2929

3030
RUN chown -R www-data:www-data *
3131

3232
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
3333

34-
# docker build -t mealplan:staging .
34+
# docker build -t mealplan:v1 .

0 commit comments

Comments
 (0)