Skip to content

Commit

Permalink
docker image lasted
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriojr committed Apr 7, 2024
1 parent 7dcd56a commit 25841da
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
name: Docker Image CI

on:
'on':
push:
branches: ["main"]
branches:
- main
pull_request:
branches: ["main"]

branches:
- main
jobs:
build_and_push:
name: 'Build and Push'
name: Build and Push
runs-on: ubuntu-latest


steps:
- name: Build the Docker image
uses: actions/checkout@v4
# run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
- name: Generate sha

id: generate_sha
run: |
SHA=$(echo $GITHUB_SHA | head -c7)
echo "sha=$SHA" >> $GITHUB_OUTPUT
- name: Build docker image
run: |
docker build -t rogeriojr/projeto-nlw-node-fastify:${{ steps.generate_sha.outputs.sha }} .
- name: Log into the container register
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push image
run: |
docker push rogeriojr/projeto-nlw-node-fastify:${{ steps.generate_sha.outputs.sha }}
docker tag docker push rogeriojr/projeto-nlw-node-fastify:${{ steps.generate_sha.outputs.sha }} rogeriojr/projeto-nlw-node-fastify:latest
docker tag rogeriojr/projeto-nlw-node-fastify:${{ steps.generate_sha.outputs.sha }} rogeriojr/projeto-nlw-node-fastify:latest
docker push rogeriojr/projeto-nlw-node-fastify:latest

0 comments on commit 25841da

Please sign in to comment.