Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
VaultVulp committed Oct 30, 2022
2 parents af42c57 + cd802dc commit 32d98d2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 27 deletions.
87 changes: 63 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Build and publish Docker Image with the `head` tag for the `develop` branch

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish

Expand All @@ -20,8 +20,8 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo

- name: Build and Publish head Docker image
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish "head" Docker image
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
Expand All @@ -30,7 +30,7 @@ jobs:
### Build and publish Docker Image with a `latest` tag for the `master` branch with different dockerfile

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish
Expand All @@ -46,8 +46,8 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build and Publish latest Docker image
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish "latest" Docker image
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide only Docker image name, tag will be automatically set to latest
Expand All @@ -56,7 +56,7 @@ jobs:

### Build and publish Docker Image with a tag equal to a git tag

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish
Expand All @@ -72,8 +72,8 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build and Publish Tag Docker image
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish Docker image tagged according to a git-tag
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide only Docker image name
Expand All @@ -82,7 +82,7 @@ jobs:

### Build and publish Docker Image with a different build context

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish
Expand All @@ -95,8 +95,8 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build and Publish Docker image from a different context
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish Docker image from a different context
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
Expand All @@ -105,7 +105,7 @@ jobs:

### Pulling an image before building it

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish
Expand All @@ -118,8 +118,8 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build and Publish head Docker image
uses: VaultVulp/gp-docker-action@1.4.0
- name: Pull, build and publish Docker image
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
Expand All @@ -128,9 +128,9 @@ jobs:

### Passing additional image tags

**NB**: `additional-image-tags` will **not** replace `image-tag` argument - additional tags will be appended to the list. If no `image-tag` was specified, then image will be tagged with the `latest` tag.
**NB**, `additional-image-tags` will **not** replace `image-tag` argument - additional tags will be appended to the list. If no `image-tag` was specified, then image will be tagged with the `latest` tag.

#### Examples:
#### Examples

##### `image-tag` was specified:
```yaml
Expand All @@ -156,28 +156,63 @@ Action will produce one image with three tags:
- `my-cool-service:second`
- `my-cool-service:third`

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish
on: push
jobs:
build-with-custom-args:
build-with-multiple-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build with --build-arg(s)
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish Docker image with multiple tags
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
image-tags: first # if ommitted will be replaced with "latest"
additional-image-tags: second third # two additional tags for an image
```

### Cross-platform builds

It's possible to leverage `custom-args` to build images for different architectures.

#### Examples
##### One architeture
```yaml
custom-args: --platform=linux/arm64 # target architecture
```
##### Multiple architetures
```yaml
custom-args: --platform=linux/arm64,linux/amd64 # multiple target architectures
```

#### Complete workflow example
```yaml
name: Build and publish
on: push
jobs:
cross-platform-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected] # Checking out the repo
- name: Build and publish Docker image for ARM64 and AMD64 architectures at the same time
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
custom-args: --platform=linux/arm64,linux/amd64 # specify target architectures via the `custom-args` agrument
```

### Passing additional arguments to the docker build command

**NB**, additional arguments should be passed with the `=` sign istead of a ` `(space) between argument name and values.
Expand All @@ -193,7 +228,7 @@ custom-args: --build-arg some="value"
# ^ this space might break the action
```

#### Full workflow example:
#### Complete workflow example
```yaml
name: Build and publish

Expand All @@ -206,14 +241,18 @@ jobs:
steps:
- uses: actions/[email protected] # Checking out the repo

- name: Build with --build-arg(s)
uses: VaultVulp/gp-docker-action@1.4.0
- name: Build and publish Docker image with arbitrary --build-arg(s)
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: my-cool-service # Provide Docker image name
custom-args: --build-arg=some="value" --build-arg=some_other="value" # Pass some additional arguments to the docker build command
```
## My own repo with examples
[VaultVulp/test-gp-docker-action](https://github.com/VaultVulp/test-gp-docker-action)
## Security considerations
You will encounter the following log message in your GitHub Actions Pipelines:
Expand Down
5 changes: 2 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ do
set -- -t $DOCKER_IMAGE_NAME_WITH_TAG "$@"
done

docker buildx build "$@"

docker push --all-tags $DOCKER_IMAGE_NAME
docker buildx create --use # Creating builder instance to support cross-platform builds
docker buildx build --push "$@"

0 comments on commit 32d98d2

Please sign in to comment.