Skip to content

Add a bit to README #143

Add a bit to README

Add a bit to README #143

Workflow file for this run

name: Docker Image CI
#on: [push, pull_request]
on:
push:
branches:
- test
- main
- dev
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v3
- name: Install Python 3.9 🐍
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up runner 📦
run: pip3 install black==24.4.2
- name: "Black: Code Formatting 👮🏽‍♀️"
run: black --diff . && black -v --check .
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Determine Docker tag
id: docker-tag
run: |
if [[ $GITHUB_REF == refs/heads/main ]]; then
echo "::set-output name=tag::latest"
elif [[ $GITHUB_REF == refs/heads/dev ]]; then
echo "::set-output name=tag::dev"
elif [[ $GITHUB_REF == refs/heads/test ]]; then
echo "::set-output name=tag::testing"
else
echo "Branch does not match any predefined tags. Exiting."
exit 1
fi
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./
file: ./environments/Dockerfile
push: true
tags: buntha/pybalance:${{ steps.docker-tag.outputs.tag }}
# base_image:
# name: Base Image for standard environment
# runs-on: ubuntu-latest
# needs: linting
#
# steps:
# - name: Checkout Repository 🛎️
# uses: actions/checkout@v3
# - name: Create tag name 🆔
# run: echo "DOCKER_TAG=$(echo "${{ github.ref_name }}" | sed -E 's/[^[:alnum:].-]+/-/g' | sed -E 's/^[^[:alnum:]]+//')" >> $GITHUB_ENV
# - name: docker
# run: docker build -t ${DOCKER_TAG} -f environments/Dockerfile .
# - name: Pytest
# run: docker run ${DOCKER_TAG} pytest
#
# base_image_gpu:
# name: Base Image for GPU environment
# runs-on: ubuntu-latest
# needs: linting
#
# steps:
# - name: Checkout Repository 🛎️
# uses: actions/checkout@v3
# - name: Create tag name 🆔
# run: echo "DOCKER_TAG=$(echo "${{ github.ref_name }}-gpu" | sed -E 's/[^[:alnum:].-]+/-/g' | sed -E 's/^[^[:alnum:]]+//')" >> $GITHUB_ENV
# - name: docker
# run: docker build -t ${DOCKER_TAG} -f environments/Dockerfile.gpu .
# - name: Pytest
# run: docker run ${DOCKER_TAG} pytest