-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ryu-sato/support/use-buildkit
Support container building using BuildKit by GitHub Actions
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ root = true | |
[*] | ||
end_of_line = lf | ||
|
||
[*.sh] | ||
[*.{sh,yml,yaml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Build and push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
DOCKERHUB_REPOSITORY: weseek/mongodb-awesome-backup | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: crazy-max/[email protected] | ||
with: | ||
version: v0.3.1 | ||
|
||
- name: Login to Docker Hub | ||
run: > | ||
echo ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | | ||
docker login --username ${{ secrets.DOCKER_REGISTRY_USERNAME }} --password-stdin | ||
- name: Build and push latest Docker Image | ||
run: > | ||
docker buildx build | ||
--tag ${DOCKERHUB_REPOSITORY} | ||
--platform linux/amd64 | ||
--cache-from type=registry,ref=${DOCKERHUB_REPOSITORY} | ||
--cache-to type=inline | ||
--push | ||
. | ||
publish_description: | ||
runs-on: ubuntu-latest | ||
needs: build_and_push | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Update Docker Hub Description | ||
uses: peter-evans/[email protected] | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | ||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | ||
DOCKERHUB_REPOSITORY: ${{ env.DOCKERHUB_REPOSITORY }} | ||
README_FILEPATH: ./README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
DOCKERHUB_REPOSITORY: weseek/mongodb-awesome-backup | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get SemVer | ||
run: | | ||
SEMVER=`git tag | sed -E 's/^v//'` | ||
echo ::set-env name=SEMVER::$SEMVER | ||
- name: Set up Docker Buildx | ||
uses: crazy-max/[email protected] | ||
with: | ||
version: v0.3.1 | ||
|
||
- name: Login to docker.io registry | ||
run: > | ||
echo ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | | ||
docker login --username ${{ secrets.DOCKER_REGISTRY_USERNAME }} --password-stdin | ||
- name: Build and push latest Docker Image | ||
run: > | ||
docker buildx build | ||
--tag ${DOCKERHUB_REPOSITORY} | ||
--platform linux/amd64 | ||
--cache-from type=registry,ref=${DOCKERHUB_REPOSITORY} | ||
--cache-to type=inline | ||
--push | ||
. | ||
- name: Tagging Docker Image by SemVer and publish | ||
uses: weseek/[email protected] | ||
with: | ||
source: ${{ env.DOCKERHUB_REPOSITORY }} | ||
target: ${{ env.DOCKERHUB_REPOSITORY }} | ||
semver: ${{ env.SEMVER }} | ||
publish: true |