-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from lilla-nemeth/feature/create-github-workf…
…low-to-push-docker-images Feature/create GitHub workflow to push docker images
- Loading branch information
Showing
5 changed files
with
70 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,31 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Lost and Found NodeJS CI | ||
name: Node.js CI with Tests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
branches: ['main'] | ||
pull_request: | ||
branches: [ "main" ] | ||
branches: ['main'] | ||
|
||
defaults: | ||
run: | ||
working-directory: server | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run Yarn | ||
run: yarn | ||
- name: Run tests | ||
run: yarn test | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run Yarn | ||
run: yarn | ||
- name: Run tests | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Docker Image CI for Github Container Registry | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
PG_PASSWORD: ${{ secrets.PG_PASSWORD }} | ||
PG_DATABASE: ${{ secrets.PG_DATABASE }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.docker | ||
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GH_PAT }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
# Build and push PostgreSQL service image | ||
docker pull postgres:16.1 | ||
docker tag postgres:16.1 ghcr.io/${{ github.repository_owner }}/postgres:16.1 | ||
docker push ghcr.io/${{ github.repository_owner }}/postgres:16.1 | ||
# Build and push Server service image | ||
docker-compose -f docker-compose.yml build server | ||
docker tag lost-and-found-server-dev:tag-v1.0.0 ghcr.io/${{ github.repository_owner }}/lost-and-found-server-dev:tag-v1.0.0 | ||
docker push ghcr.io/${{ github.repository_owner }}/lost-and-found-server-dev:tag-v1.0.0 | ||
# Build and push Client service image | ||
docker-compose -f docker-compose.yml build client | ||
docker tag lost-and-found-client-dev:tag-v1.0.0 ghcr.io/${{ github.repository_owner }}/lost-and-found-client-dev:tag-v1.0.0 | ||
docker push ghcr.io/${{ github.repository_owner }}/lost-and-found-client-dev:tag-v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignore": ["**/*.yml", "**/*.yaml"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters