Merge pull request #658 from alan-turing-institute/644-image-placeholder #474
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
name: frontend-docker | |
on: | |
push: | |
branches: [main, develop] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Set environment | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
echo "commit_date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Get environment | |
shell: bash | |
run: | | |
echo "sha_short: ${{ env.sha_short }}" | |
echo "commit_date: ${{ env.commit_date }}" | |
echo "version: ${{ env.commit_date }}.${{ env.sha_short }}" | |
- name: "Build main" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
working-directory: next_frontend | |
run: | | |
docker build \ | |
--build-arg GITHUB_APP_CLIENT_ID=${{ secrets.GH_APP_CLIENT_ID }} \ | |
--build-arg GITHUB_APP_CLIENT_SECRET=${{ secrets.GH_APP_CLIENT_SECRET }} \ | |
--build-arg NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} \ | |
--build-arg NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} \ | |
--build-arg API_URL=https://eap-backend.azurewebsites.net/ \ | |
--build-arg NEXTAUTH_URL=https://assuranceplatform.azurewebsites.net/ \ | |
-t turingassuranceplatform/eap_frontend:main \ | |
-t turingassuranceplatform/eap_frontend:${{ env.commit_date }}.${{ env.sha_short }} \ | |
-f docker/staging/Dockerfile . | |
docker push turingassuranceplatform/eap_frontend --all-tags | |
- name: "Build develop" | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
working-directory: next_frontend | |
run: | | |
docker build \ | |
--build-arg GITHUB_APP_CLIENT_ID=${{ secrets.GH_APP_CLIENT_ID_STAGING }} \ | |
--build-arg GITHUB_APP_CLIENT_SECRET=${{ secrets.GH_APP_CLIENT_SECRET_STAGING }} \ | |
--build-arg NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET_STAGING }} \ | |
--build-arg NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL_STAGING }} \ | |
--build-arg API_URL=https://staging-eap-backend.azurewebsites.net/ \ | |
--build-arg NEXTAUTH_URL=https://staging-assuranceplatform.azurewebsites.net/ \ | |
-t turingassuranceplatform/eap_frontend:develop \ | |
-t turingassuranceplatform/eap_frontend:${{ env.commit_date }}.${{ env.sha_short }}\ | |
-f docker/staging/Dockerfile . | |
docker push turingassuranceplatform/eap_frontend --all-tags |