Skip to content

Commit

Permalink
Create docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cauta authored Apr 1, 2024
1 parent 218f661 commit 119a2b7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Change directory to app
run: cd app

- name: Determine version from codebase
run: |
# Example: Extract version from package.json
VERSION=$(jq -r '.version' package.json)
echo "::set-output name=version::$VERSION"
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/onebox:${{ steps.determine_version.outputs.version }} .

- name: Push Docker image to Docker Hub
run: docker push ${{ secrets.DOCKER_USERNAME }}/onebox:${{ steps.determine_version.outputs.version }}

0 comments on commit 119a2b7

Please sign in to comment.