-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
130 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: Push frontend to Dockerhub | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
# backend-image: | ||
# name: Build backend image | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - name: ☁️ Checkout source | ||
# uses: actions/checkout@v3 | ||
# - name: Save commit hashes for tag | ||
# id: commit | ||
# uses: pr-mpt/actions-commit-hash@v2 | ||
# - name: 🔧 Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
# - name: 🔧 Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v2 | ||
# - name: Cache Docker layers | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: /tmp/.buildx-cache | ||
# key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-buildx- | ||
# - name: 🐋 Login to Docker Hub | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# - name: 📦 Build backend and export to Docker | ||
# uses: docker/build-push-action@v3 | ||
# with: | ||
# load: true | ||
# context: backend | ||
# tags: infisical/backend:test | ||
# cache-from: type=local,src=/tmp/.buildx-cache | ||
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
# - name: ⏻ Spawn backend container and dependencies | ||
# run: | | ||
# docker compose -f .github/resources/docker-compose.be-test.yml up --wait --quiet-pull | ||
# - name: 🧪 Test backend image | ||
# run: | | ||
# ./.github/resources/healthcheck.sh infisical-backend-test | ||
# - name: ⏻ Shut down backend container and dependencies | ||
# run: | | ||
# docker compose -f .github/resources/docker-compose.be-test.yml down | ||
# - name: 🏗️ Build backend and push | ||
# uses: docker/build-push-action@v3 | ||
# with: | ||
# push: true | ||
# context: backend | ||
# tags: infisical/backend:${{ steps.commit.outputs.short }}, | ||
# infisical/backend:latest | ||
# platforms: linux/amd64,linux/arm64 | ||
# cache-from: type=local,src=/tmp/.buildx-cache | ||
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
# - # Temp fix | ||
# # https://github.com/docker/build-push-action/issues/252 | ||
# # https://github.com/moby/buildkit/issues/1896 | ||
# name: Move cache | ||
# run: | | ||
# rm -rf /tmp/.buildx-cache | ||
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
|
||
frontend-image: | ||
name: Build frontend image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: ☁️ Checkout source | ||
uses: actions/checkout@v3 | ||
- name: Save commit hashes for tag | ||
id: commit | ||
uses: pr-mpt/actions-commit-hash@v2 | ||
- name: 🔧 Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: 🔧 Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: 🐋 Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: 📦 Build frontend and export to Docker | ||
uses: docker/build-push-action@v3 | ||
with: | ||
load: true | ||
context: frontend | ||
tags: infisical/frontend:test | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
build-args: | | ||
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} | ||
- name: ⏻ Spawn frontend container | ||
run: | | ||
docker run -d --rm --name infisical-frontend-test infisical/frontend:test | ||
- name: 🧪 Test frontend image | ||
run: | | ||
./.github/resources/healthcheck.sh infisical-frontend-test | ||
- name: ⏻ Shut down frontend container | ||
run: | | ||
docker stop infisical-frontend-test | ||
- name: 🏗️ Build frontend and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
context: frontend | ||
tags: infisical/frontend:${{ steps.commit.outputs.short }}, | ||
infisical/frontend:latest | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
build-args: | | ||
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} | ||
- # Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |