Skip to content

Commit

Permalink
Merge pull request #4 from gnadaban/add-github-build
Browse files Browse the repository at this point in the history
Add docker build action to make sure image actually builds before posting to Dockerhub
  • Loading branch information
blueskyjunkie authored Jul 9, 2021
2 parents 484064e + 2039bca commit a45648b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ci

on:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: foodxtech/azure-devops-agent
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ RUN apt-get update \
libunwind8 \
lsb-release \
netcat \
tzdata \
# Install .NETCore runtime dependency for the agent
# See details of this here: https://github.com/dotnet/core/issues/4360#issuecomment-618784475
&& LIBICU_FILE="libicu66_66.1-2ubuntu2_amd64.deb" \
&& curl -fsSLo ${LIBICU_FILE} https://mirrors.edge.kernel.org/ubuntu/pool/main/i/icu/${LIBICU_FILE} \
&& dpkg -i ${LIBICU_FILE} \
# Install Azure CLI
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
Expand Down

0 comments on commit a45648b

Please sign in to comment.