Docker Image Build And Deploy #7
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
name: Docker Image Build And Deploy | |
on: | |
workflow_dispatch: | |
jobs: | |
docker: | |
env: | |
IMAGE_NAME: 'fujikomalan/flask-github' | |
runs-on: self-hosted | |
steps: | |
- name: Checking Docker Installation | |
run: | | |
docker version | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker Image | |
run: | | |
docker build -t ${{env.IMAGE_NAME}}:latest -t ${{env.IMAGE_NAME}}:$COMMIT_ID . | |
- name: Push Docker Image | |
run: | | |
docker push ${{env.IMAGE_NAME}}:latest | |
docker push ${{env.IMAGE_NAME}}:$COMMIT_ID | |
- name: Running Docker Container | |
run: | | |
docker container run -d --name flaskapp -p 8080:5000 ${{env.IMAGE_NAME}}:latest |