Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/test-docker-build-complex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test docker build custom file
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"

test:
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ./
id: current
with:
workdir: ./test/custom
file: Dockerfile_complex
organization: ${{ github.event.repository.owner.login }}
repository: ${{ github.event.repository.name }}
registry: registry.hub.docker.com
login: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- uses: nick-fields/assert-action@v1
with:
expected: 'registry.hub.docker.com/cloudposse/github-action-docker-build-push'
actual: ${{ steps.current.outputs.image }}

teardown:
runs-on: ubuntu-latest
needs: [test]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Build Docker image and push it.

| Name | Description | Default | Required |
|------|-------------|---------|----------|
| file | Dockerfile name | Dockerfile | false |
| login | Docker login | | false |
| organization | Organization | N/A | true |
| password | Docker password | | false |
Expand Down
5 changes: 3 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ inputs:
default: './'
file:
description: 'Dockerfile name'
required: false
required: false
default: 'Dockerfile'
organization:
description: 'Organization'
required: true
Expand Down Expand Up @@ -68,7 +69,7 @@ runs:
uses: docker/build-push-action@v2
with:
context: ${{ inputs.workdir }}
file: ${{ inputs.file }}
file: ${{ inputs.workdir }}/${{ inputs.file }}
pull: true
push: true
cache-from: type=gha
Expand Down
1 change: 1 addition & 0 deletions docs/github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

| Name | Description | Default | Required |
|------|-------------|---------|----------|
| file | Dockerfile name | Dockerfile | false |
| login | Docker login | | false |
| organization | Organization | N/A | true |
| password | Docker password | | false |
Expand Down
1 change: 1 addition & 0 deletions test/custom/Dockerfile_complex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM nginx:1.23.0-alpine