Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reusable workflow for Docker #518

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

veaceslavdoina
Copy link
Contributor

@veaceslavdoina veaceslavdoina commented Aug 16, 2023

This PR adds reusable workflow for Docker builds (codex-storage/cs-codex-dist-tests/issues/42)

  1. Reusable workflow - docker-reusable.yml
  2. Main workflow - docker.yml
  3. Dist-Tests workflow - docker-dist-tests.yml

Usage example

# Minimal
jobs:
  build-and-push:
    name: Build and Push
    uses: ./.github/workflows/docker-reusable.yaml
    secrets: inherit

# Fully customized
jobs:
  build-and-push:
    name: Build and Push
    uses: ./.github/workflows/docker-reusable.yaml
    with:
      docker_file: docker/codex.Dockerfile
      docker_repo: codexstorage/nim-codex
      make_parallel: 4
      nat_ip_auto: false
      tag_latest: true
      tag_sha: true
      tag_suffix: ''
    secrets: inherit

Workflow accept the following parameters

Parameter Default
docker_file docker/codex.Dockerfile
docker_repo codexstorage/nim-codex
make_parallel 4
nimflags -d:disableMarchNative
nat_ip_auto false
tag_latest true
tag_sha true
tag_suffix ''

Tags

# Configuration Git Commit Git Tag
1 tag_latest=false
tag_sha=true
sha-af3cc6d 0.0.1
2 tag_latest=true
tag_sha=false
latest 0.0.1
latest
3 tag_latest=true
tag_sha=true
latest, sha-af3cc6d latest
0.0.1
4 tag_latest=false
tag_sha=true
tag_suffix=custom
sha-af3cc6d-custom 0.0.1-custom
5 tag_latest=true
tag_sha=false
tag_suffix=custom
latest-custom latest-custom
0.0.1-custom
6 tag_latest=true
tag_sha=true
tag_suffix=custom
latest-custom, sha-af3cc6d-custom latest-custom, 0.0.1-custom

Test result

# Main
docker run --rm -p 8080:8080 codexstorage/nim-codex:latest codex --api-bindaddr=0.0.0.0

# Dist-Tests
docker run --rm -p 8080:8080 codexstorage/nim-codex:latest-dist-tests codex --api-bindaddr=0.0.0.0

@veaceslavdoina veaceslavdoina changed the title Add reusable workflow for Docker (codex-storage/cs-codex-dist-tests/i… Add reusable workflow for Docker Aug 16, 2023
Copy link
Contributor

@emizzle emizzle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good Slava, well done! 🥳

@veaceslavdoina veaceslavdoina merged commit ba41b5a into master Aug 17, 2023
8 checks passed
@veaceslavdoina veaceslavdoina deleted the feat/add-reusable-workflow-for-docker branch August 17, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants