Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WTH Core] Create Github Workflow to build IntroToAKS docker images #284

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
102 changes: 102 additions & 0 deletions .github/workflows/001IntroAKS-BuildDockerImages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build and Push IntrotoAKS Docker Images
on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
# These four variables MUST be modified to reflect the WTH repo requirements!
REGISTRY: ghcr.io # Replace this with 'docker.io' if you are going to push to dockerhub
REPOSITORY: larryms # Replace with 'whatthehackmsft' for use by the whatthehack project
CONTENTWEBTAG: ${{ env.REPOSITORY }}/content-web
CONTENTAPITAG: ${{ env.REPOSITORY }}/content-api
CONTENTINITTAG: ${{ env.REPOSITORY }}/content-init
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
# To use DockerHub, you'll need to do the following:
# 1. Replace the username parameter below with the name of your dockerhub username, eg, whatthehackmsft
# 2. Create an access token at https://hub.docker.com/settings/security
# 3. Store that token as a github secret (via https://github.com/microsoft/WhatTheHack/settings/secrets/actions), eg call the secret 'DOCKERHUB_TOKEN'
# 4. Replace the password parameter below with your dockerhub secret, eg secrets.DOCKERHUB_TOKEN
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push content-web v1
uses: docker/build-push-action@v2
id: contentwebv1
with:
push: true
# Build's context is the set of files located in the specified PATH or URL
context: '001-IntroToKubernetes/Student/Resources/Challenge 1/content-web'
# Path to the Dockerfile
file: '001-IntroToKubernetes/Coach/Solutions/Challenge 1/content-web/Dockerfile-solution'
# List of tags
tags: ${{ env.REGISTRY }}/${{env.CONTENTWEBTAG}}:v1, ${{ env.REGISTRY }}/${{env.CONTENTWEBTAG}}:latest
#github-token: # optional, default is ${{ github.token }}

- name: Build and push content-api v1
uses: docker/build-push-action@v2
id: contentapiv1
with:
push: true
# Build's context is the set of files located in the specified PATH or URL
context: '001-IntroToKubernetes/Student/Resources/Challenge 1/content-api'
# Path to the Dockerfile
file: '001-IntroToKubernetes/Coach/Solutions/Challenge 1/content-api/Dockerfile-solution'
# List of tags
tags: ${{ env.REGISTRY }}/${{env.CONTENTAPITAG}}:v1, ${{ env.REGISTRY }}/${{env.CONTENTAPITAG}}:latest
#github-token: # optional, default is ${{ github.token }}

- name: Build and push content-web v2
uses: docker/build-push-action@v2
id: contentwebv2
with:
push: true
# Build's context is the set of files located in the specified PATH or URL
context: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-web-v2'
# Path to the Dockerfile
file: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-web-v2/Dockerfile'
# List of tags
tags: ${{ env.REGISTRY }}/${{env.CONTENTWEBTAG}}:v2
#github-token: # optional, default is ${{ github.token }}

- name: Build and push content-api v2
uses: docker/build-push-action@v2
id: contentapiv2
with:
push: true
# Build's context is the set of files located in the specified PATH or URL
context: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-api-v2'
# Path to the Dockerfile
file: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-api-v2/Dockerfile'
# List of tags
tags: ${{ env.REGISTRY }}/${{env.CONTENTAPITAG}}:v2
#github-token: # optional, default is ${{ github.token }}

- name: Build and push content-init
uses: docker/build-push-action@v2
id: contentinit
with:
push: true
# Build's context is the set of files located in the specified PATH or URL
context: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-init'
# Path to the Dockerfile
file: '001-IntroToKubernetes/Student/Resources/Challenge 7/content-init/Dockerfile'
# List of tags
tags: ${{ env.REGISTRY }}/${{env.CONTENTINITTAG}}:latest
#github-token: # optional, default is ${{ github.token }}