Update README.md to enhance CI/CD and deployment documentation #214
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
# Github workflow runner instructions using cutomized actions | |
name: Refresher CI — Docker | |
on: [ push ] | |
jobs: | |
build-push: | |
runs-on: ubuntu-latest | |
name: build docker | |
steps: | |
########## CHECK OUT REPO AND PRINT REPO INFO ####### | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Intro to job runner | |
run: | | |
echo "job runner details " | |
echo "Event: ${{ github.event_name }}" | |
echo "os: ${{ runner.os }} server." | |
echo "Repository: ${{ github.repository }}:${{ github.ref_name }}." | |
ls ${{ github.workspace }} | |
######### DOCKER BUILD AND PUSH CUSTOM ACTION ############# | |
- name: Docker Build and Push | |
uses: ./.github/actions/docker-build-push-image | |
with: | |
username: | |
${{ github.REPOSITORY_OWNER }} | |
password: | |
${{ secrets.pta }} | |
registry: | |
ghcr.io | |
repository: | |
${{ github.repository }} | |
tag: | |
${{ github.ref_name }} | |
file: | |
docker/Dockerfile | |
test_docker: | |
needs: build-push | |
runs-on: ubuntu-latest | |
name: test docker | |
steps: | |
########## CHECK OUT REPO AND PRINT REPO INFO ####### | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
######### DOCKER LOGIN AND PULL CUSTOM ACTION ############# | |
- name: Docker Login and Pull | |
uses: ./.github/actions/docker-pull-image | |
with: | |
username: | |
${{ github.REPOSITORY_OWNER }} | |
password: | |
${{ secrets.pta }} | |
registry: | |
ghcr.io | |
repository: | |
${{ github.repository }} | |
tag: | |
${{ github.ref_name }} | |
# Verify container exists and can run | |
- name: Verify container | |
run: | | |
# List available images to verify pull | |
docker images | |
# Try running container with simple command | |
docker run --rm ghcr.io/${{ github.repository }}:${{ github.ref_name }} python -c "print('Container is working')" | |
# Run actual tests if container verification passes | |
- name: Run tests in container | |
run: | | |
docker run --rm ghcr.io/${{ github.repository }}:${{ github.ref_name }} /bin/bash -c " | |
coverage run manage.py test apps | |
" |