diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6f98693 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,13 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 +# Use a package of configuration called an orb. +orbs: + # Declare a dependency on the welcome-orb + welcome: circleci/welcome-orb@0.4.1 +# Orchestrate or schedule a set of jobs +workflows: + # Name the workflow "welcome" + welcome: + # Run the welcome/run job in its own container + jobs: + - welcome/run diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..5b123f8 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,76 @@ +name: Docker + +on: + push: + # Publish `master` as Docker `latest` image. + branches: + - master + + # Publish `v1.2.3` tags as releases. + tags: + - v* + + # Run tests for any PRs. + pull_request: + +env: + # TODO: Change variable to your image's name. + IMAGE_NAME: image + +jobs: + # Run tests. + # See also https://docs.docker.com/docker-hub/builds/automated-testing/ + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run tests + run: | + if [ -f docker-compose.test.yml ]; then + docker-compose --file docker-compose.test.yml build + docker-compose --file docker-compose.test.yml run sut + else + docker build . --file Dockerfile + fi + + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + # Ensure test job passes before pushing image. + needs: test + + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + + - name: Push image + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/README.md b/README.md index abb795e..d0841c2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Building Docker Doodles ----------------------- +[![Build status](https://ci.appveyor.com/api/projects/status/tqtf7w82x6pd0d8g/branch/master?svg=true)](https://ci.appveyor.com/project/dslzuha/doodle/branch/master) Building can be done with the original `docker build`, or with the new *BuildKit* application. The new experimental 'buildx' command, which is in nightly builds as well as in the Docker Engine 19.03 release, @@ -10,7 +11,7 @@ cross platform. To build for your own platform with the original docker build command, use: -`cd && docker build -t /doodle: ./` +`cd cheers2019 && docker build -t dslzuha/doodle:cheers2019 ./` To build cross platform, use the `Dockerfile.cross` file, either with *BuildKit* directly, or with *buildx*. With buildx, you'll first need to create a cross platform `builder` instance with: @@ -20,7 +21,7 @@ With buildx, you'll first need to create a cross platform `builder` instance wit You only need to create one builder instance, and should not need to create new ones with subsequent builds. To create and push the multi-arch image to Docker Hub, use the command: -`cd && docker buildx build -f Dockerfile.cross --platform linux/amd64,linux/arm64,linux/arm/v8,linux/s390x,linux/ppc64le,windows/amd64 -t /doodle: --push .` +`cd cheers2019 && docker buildx build -f Dockerfile.cross --platform linux/amd64,linux/arm64,linux/arm/v8,linux/s390x,linux/ppc64le,windows/amd64 -t dslzuha/doodle:cheers2019 --push .` This will build the Doodle for these architectures: * linux/amd64 (64 bit Linux native) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..d78650d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,5 @@ +version: 1.0.{build} +image: Ubuntu +nuget: + account_feed: true + project_feed: true diff --git a/cheers2019/README.md b/cheers2019/README.md index eb65301..d7d3ccd 100644 --- a/cheers2019/README.md +++ b/cheers2019/README.md @@ -7,6 +7,6 @@ It's time for Dockercon SF 2019, and Moby wanted to celebrate it in docker style To try it out, run: -`docker run -it --rm docker/doodle:cheers` +`docker run -it --rm dslzuha/doodle:cheers2019` -Complete source can be found [here](https://github.com/docker/doodle). +Complete source can be found [here](https://github.com/dslzuha/doodle).