Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
honzov committed Apr 17, 2024
1 parent 9bae46d commit c6a4e09
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/actions/build-push-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Build and push docker image'
description: 'Build our dockerfile'
inputs:
imgname:
description: 'Name of the image to build'
required: true
build_cuda:
description: 'Flag to indicate whether to build with CUDA support'
required: true
dockerhub_token_user:
description: 'Docker username'
required: true
dockerhub_token:
description: Docker password
required: true
runs:
using: composite
steps:
- run: |
TODAY=$(date +'%Y-%m-%d')
cd dockerfiles
sudo docker login -u ${dockerhub_token_user} -p ${dockerhub_token}
sudo docker build -f Dockerfile.${imgname} --rm --no-cache -t "iterait/${imgname}:${TODAY}" -t "iterait/${imgname}:latest" --squash .
sudo docker push iterait/${imgname}:latest
sudo docker push iterait/${imgname}:"${TODAY}"
if [ "${build_cuda}" == "true" ]; then
sudo docker build -f Dockerfile.${imgname} --rm --no-cache --build-arg tag="cuda" -t "iterait/${imgname}:cuda_${TODAY}" -t "iterait/${imgname}:cuda" --squash .
sudo docker push iterait/${imgname}:cuda
sudo docker push iterait/${imgname}:"cuda_${TODAY}"
fi
shell: bash
env:
imgname: ${{ inputs.imgname }}
build_cuda: ${{ inputs.build_cuda }}
dockerhub_token_user: ${{ inputs.dockerhub_token_user }}
dockerhub_token: ${{ inputs.dockerhub_token }}
59 changes: 59 additions & 0 deletions .github/workflows/build-push-images-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Images Build

on:
push:

# schedule:
# - cron: '0 3 * * *'

jobs:
build_archlinux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/build-push-image
with:
imgname: archlinux
build_cuda: false
dockerhub_token_user: ${{ secrets.DOCKERHUB_TOKEN_USER }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Checkout code
# uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Login to Docker hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_TOKEN_USER }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push archlinux
# run: |
# TODAY=$(date +'%Y-%m-%d')
# cd dockerfiles
# for imgname in archlinux ; do
# docker build -f Dockerfile.${imgname} --no-cache --platform linux/amd64 --push \
# -t "iterait/${imgname}:${TODAY}" -t "iterait/${imgname}:latest" \
# -t "iterait/${imgname}:cuda_${TODAY}" -t "iterait/${imgname}:cuda" \
# --build-arg tag="cuda" --squash .
# done
# build_and_push_images:
# runs-on: ubuntu-latest

# steps:


# - name: Build and push Docker images
# run: |
# TODAY=$(date +'%Y-%m-%d')
# for imgname in archlinux archlinux-dev tensorflow; do
# docker buildx build -f Dockerfile.${imgname} --no-cache --platform linux/amd64 --push \
# -t "iterait/${imgname}:${TODAY}" -t "iterait/${imgname}:latest" \
# -t "iterait/${imgname}:cuda_${TODAY}" -t "iterait/${imgname}:cuda" \
# --build-arg tag="cuda" --squash .
# done
# env:
# CIRCLE_BRANCH: ${{ github.ref }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c6a4e09

Please sign in to comment.