Skip to content

Commit

Permalink
git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Aug 28, 2024
1 parent 8c4dc6e commit 6d1bf44
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,33 @@ jobs:

- name: Get package version
id: get_version
run: echo "::set-output name=version::$(jq -r .version package.json)"
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_ENV

- name: Debug Pre-Build Information
run: |
docker run --rm node:latest node -v
docker run --rm node:latest npm -v
docker run --rm node:latest git --version
- name: Build and tag Docker image
run: |
docker build . --file Dockerfile --tag codechat/api:${{ steps.get_version.outputs.version }}
docker tag codechat/api:${{ steps.get_version.outputs.version }} codechat/api:latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile
push: true
tags: codechat/api:develop
tags: |
codechat/api:latest
codechat/api:${{ env.version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

0 comments on commit 6d1bf44

Please sign in to comment.