Skip to content

Commit

Permalink
build baseimage in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
DerouineauNicolas committed Jun 25, 2024
1 parent f25954f commit f7389ce
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 5 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,37 @@ on:
- master

jobs:
build-baselayer:

build:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Pull old base image
run: |
docker image pull webmultimedia/http-streaming-server-baseimage:dev
-
name: Build and export to Docker
uses: docker/build-push-action@v3
with:
context: .
file: ./backend/Dockerfile.baseimage
push: true
tags: webmultimedia/http-streaming-server-baseimage:dev
build-app:
needs: build-baselayer
runs-on: ubuntu-latest

steps:
Expand Down
43 changes: 42 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,50 @@ on:
branches: [ "master" ]

jobs:
build-baselayer:

build:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Pull old base image
run: |
docker image pull webmultimedia/http-streaming-server-baseimage:master
-
name: Build and export to Docker
uses: docker/build-push-action@v3
with:
context: .
file: ./backend/Dockerfile.baseimage
push: true
tags: webmultimedia/http-streaming-server-baseimage:master
-
name: Test Backend
run: |
cp -r tests/* Videos/
docker-compose -f docker-compose-prod.yml run --rm web ./wait-for-it.sh db:5432 -- python3 manage.py test
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./backend/Dockerfile.prod
push: true
tags: webmultimedia/http-streaming-server:master
build-app:
needs: build-baselayer
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#See Dockerfile.baseimage to see how the baseimage is build.
FROM webmultimedia/http-streaming-server-baseimage:1.0.4
FROM webmultimedia/http-streaming-server-baseimage:master

ENV PYTHONUNBUFFERED 1

Expand Down
3 changes: 1 addition & 2 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ RUN npm run build
#Build the backend

#See Dockerfile.baseimage to see how the baseimage is build.
FROM webmultimedia/http-streaming-server-baseimage:1.0.4

FROM webmultimedia/http-streaming-server-baseimage:master

ENV PYTHONUNBUFFERED 1
COPY --from=0 /usr/src/frontend/build/ /usr/src/frontend/build/
Expand Down

0 comments on commit f7389ce

Please sign in to comment.