{"id":13821052,"url":"https://github.com/jerray/publish-docker-action","last_synced_at":"2025-04-11T20:32:08.285Z","repository":{"id":47435299,"uuid":"209956212","full_name":"jerray/publish-docker-action","owner":"jerray","description":"GitHub Action used to build, tag and publish docker image to your docker registry","archived":false,"fork":false,"pushed_at":"2021-08-06T07:49:42.000Z","size":44,"stargazers_count":30,"open_issues_count":4,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-22T03:17:42.574Z","etag":null,"topics":["docker","github-actions"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/publish-docker-action","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jerray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-21T09:15:21.000Z","updated_at":"2022-11-20T16:04:35.000Z","dependencies_parsed_at":"2023-01-04T14:15:12.081Z","dependency_job_id":null,"html_url":"https://github.com/jerray/publish-docker-action","commit_stats":{"total_commits":20,"total_committers":5,"mean_commits":4.0,"dds":"0.19999999999999996","last_synced_commit":"87d84711629b0dc9f6bb127b568413cc92a2088e"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerray%2Fpublish-docker-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerray%2Fpublish-docker-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerray%2Fpublish-docker-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerray%2Fpublish-docker-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerray","download_url":"https://codeload.github.com/jerray/publish-docker-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248476387,"owners_count":21110269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","github-actions"],"created_at":"2024-08-04T08:01:14.396Z","updated_at":"2025-04-11T20:32:03.270Z","avatar_url":"https://github.com/jerray.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Publish Docker Action\n\n[![GitHub Action](https://github.com/jerray/publish-docker-action/workflows/Main/badge.svg)](https://github.com/jerray/publish-docker-action/actions?workflow=Main)\n[![codecov](https://codecov.io/gh/jerray/publish-docker-action/branch/master/graph/badge.svg)](https://codecov.io/gh/jerray/publish-docker-action)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/jerray/publish-docker-action?logo=github)](https://github.com/jerray/publish-docker-action/releases)\n[![Docker Pulls](https://img.shields.io/docker/pulls/jerray/publish-docker-action?logo=docker)](https://hub.docker.com/r/jerray/publish-docker-action)\n\nPublish Docker Action builds, creates tags and pushes docker image to your docker registry.\n\n## Usage\n\nThis simple example uses `Dockerfile` in your workspace to build image, attach the `latest`\ntag and push to docker default registry (docker.io). Repository name is your GitHub repository\nname by default.\n\n```yaml\n- uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n```\n\nUse `file` and `path` arguments to set docker build file or build context if they are not in the default workspace.\n\n### Set up registry and repository name\n\nYou can set docker registry with `registry` argument. Change docker repository name with `repository` argument.\nFor example:\n\n```yaml\n- uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    registry: docker.pkg.github.com\n    repository: jerray/publish-docker-action\n```\n\nThis will build and push the tag `docker.pkg.github.com/jerray/publish-docker-action:latest`.\n\n### Tags\n\n#### Static Tag List\n\nYou can use static tag list by providing `tags` argument. Concat multiple tag names with commas.\n\n```yaml\n- uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    registry: docker.pkg.github.com\n    repository: jerray/publish-docker-action\n    tags: latest,newest,master\n```\n\nThis example builds the image, creates three tags, and pushes all of them to the registry.\n\n* `docker.pkg.github.com/jerray/publish-docker-action:latest`\n* `docker.pkg.github.com/jerray/publish-docker-action:newest`\n* `docker.pkg.github.com/jerray/publish-docker-action:master`\n\n#### Auto Tag\n\nSet `with.auto_tag: true` to allow action generate docker image tags automatically.\n\n```yaml\n- uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    registry: docker.pkg.github.com\n    repository: jerray/publish-docker-action\n    auto_tag: true\n```\n\nGenerated tags vary with `refs` types:\n\n* branch: uses the branch name as docker tag name (`master` branch is renamed to `latest`).\n* pull request: attaches a `pr-` prefix to branch name asdocker image tag. To allow pull request build, you must set `with.allow_pull_request` to `true`.\n* tag: checks if the tag name is valid semantic version format (prefix `v` is allowed). If not, it uses git tag name as docker image tag directly. Else it generates three tags based on the version number, each followed with pre-release information.\n\nExamples:\n\n| Git | Docker Tag |\n| --- | --- |\n| branch `master` | `latest` |\n| branch  `2019/09/28-new-feature` | `2019-09-28-new-feature` (`/` is replaced to `-`) |\n| pull request `master` | `pr-master` |\n| tag `1.0.0` | `1`, `1.0`, `1.0.0` |\n| tag `v1.0.0` | `1`, `1.0`, `1.0.0` |\n| tag `v1.0.0-rc1` | `1-rc1`, `1.0-rc1`, `1.0.0-rc1` |\n| tag `20190921-actions` | `20190921-actions` (not semantic version) |\n\nAuto tagging will override `with.tags` list.\n\nAdditionally, there's an output value `tag` you can use [in your next steps](https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#steps-context).\n\n```yaml\n- id: build\n  uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    registry: docker.pkg.github.com\n    repository: jerray/publish-docker-action\n    auto_tag: true\n\n- id: deploy\n  env:\n    NEW_VERSION: ${{ steps.build.outputs.tag }}\n  run: |\n    docker pull $NEW_VERSION\n```\n\n### Cache\n\nProvide `with.cache` argument to build from cache.\n\n### Build Args\n\nUse `with.build_args` to provide docker build-time variables. Multiple variables must be separated by comma. \n\n```yaml\n- uses: jerray/publish-docker-action@master\n  with:\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    registry: docker.pkg.github.com\n    repository: jerray/publish-docker-action\n    build_args: HTTP_PROXY=http://127.0.0.1,USER=nginx\n```\n\n### Target for Multi-Stage Builds\n\nProvide `with.target` argument to set `--target` flag for docker build.\n\n## Note\n\nPlease use the latest released version rather than master.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerray%2Fpublish-docker-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerray%2Fpublish-docker-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerray%2Fpublish-docker-action/lists"}