ci: added Ci for build docker
This commit is contained in:
1 parent
2ee40cf989
commit
485eb08da7
1 file changed
+53
@@ -0,0 +1,53 @@
|
||||
name: Build, Test and Push Flask App
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
docker-build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y docker.io
|
||||
docker --version
|
||||
|
||||
- name: Configure Docker CLI for insecure registry
|
||||
run: |
|
||||
mkdir -p ~/.docker
|
||||
echo '{"insecure-registries" : ["git.rustprogersteam.ru"]}' > ~/.docker/config.json
|
||||
cat ~/.docker/config.json
|
||||
|
||||
- name: 'Docker Tags'
|
||||
id: tags
|
||||
uses: https://github.com/cssnr/docker-tags-action@v2
|
||||
with:
|
||||
images: 'git.rustprogersteam.ru/${{ vars.DOCKER_USERNAME }}/myresume'
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.rustprogersteam.ru
|
||||
username: ${{ vars.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
git.rustprogersteam.ru/${{ vars.DOCKER_USERNAME }}/myresume/resume:latest
|
||||
git.rustprogersteam.ru/${{ vars.DOCKER_USERNAME }}/myresume/resume:${{ github.sha }}
|
||||
labels: ${{ steps.tags.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
Reference in new issue
Block a user