A Github action for building and pushing docker images.
| Input | Description |
|---|---|
| imageName | The name of the docker image |
| workingDirectory | The working directory from which to run the docker commands (default: .) |
| dockerRegistry | The registry to push the image name (default: docker.io) |
| dockerfile | Path to Dockerfile (default: Dockerfile) |
| latestBranch | From which branch to create latest releases (default: master) |
| buildArgs | List of environment variables that are passed to docker via --build-arg <BUILD_ARG> (default: empty) |
| Output | Description |
|---|---|
| dockerTag | The docker tag of the built image |
Note: This function only builds and pushes docker images. Logging in should be used with other actions.
docker:
name: Publish Docker Image
runs-on: self-hosted
steps:
- run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets. DOCKER_PASSWORD }}
- uses: philips-labs/docker-action@master
with:
imageName: hello-worlddocker:
name: Publish Docker Image
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- run: docker login my-docker-registry.io -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets. DOCKER_PASSWORD }}
- uses: philips-labs/docker-action@master
with:
imageName: hello-world
dockerRegistry: my-docker-registry.iodocker:
name: Publish Docker Image
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- uses: philips-labs/docker-action@master
with:
imageName: hello-world
dockerRegistry: ${{ steps.login_ecr.outputs.registry }}
- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}