Skip to content

fix: filebase image optimization error #315

fix: filebase image optimization error

fix: filebase image optimization error #315

# build and push docker image to docker hub
name: Build & Deploy Prod
on:
push:
branches:
- "main"
env:
IMAGE_NAME: rss3/xlog
REGION_ID: us-east-1
ACK_CLUSTER_ID: cfc647c22fd6848b5a602ad4d7470632b
jobs:
build:
runs-on: ubuntu-latest
environment: Production
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- uses: hmarr/debug-action@v2
- name: Checkout
uses: actions/checkout@v4
- name: docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix={{branch}}-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"NEXT_PUBLIC_DISCORD_LINK=${{ vars.NEXT_PUBLIC_DISCORD_LINK }}"
"NEXT_PUBLIC_GITHUB_LINK=${{ vars.NEXT_PUBLIC_GITHUB_LINK }}"
"NEXT_PUBLIC_OUR_DOMAIN=${{ vars.NEXT_PUBLIC_OUR_DOMAIN }}"
"NEXT_PUBLIC_TWITTER_LINK=${{ vars.NEXT_PUBLIC_TWITTER_LINK }}"
"NEXT_PUBLIC_WALLET_CONNECT_V2_PROJECT_ID=${{ vars.NEXT_PUBLIC_WALLET_CONNECT_V2_PROJECT_ID }}"
"NEXT_PUBLIC_IPFS_GATEWAY=${{ vars.NEXT_PUBLIC_IPFS_GATEWAY }}"
deploy-prod:
runs-on: ubuntu-latest
environment: Production
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set K8s context
uses: aliyun/ack-set-context@v1
with:
access-key-id: "${{ secrets.ACCESS_KEY_ID }}"
access-key-secret: "${{ secrets.ACCESS_KEY_SECRET }}"
cluster-id: "${{ env.ACK_CLUSTER_ID }}"
- run: |
wget https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/local/bin/yq
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.22.10/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/kubectl
- uses: sljeff/secrets2env@main
with:
secrets-json: ${{ toJson(secrets) }}
- run: |
sh apply.sh deploy/prod/*
env:
IMAGE_TAG_RELEASE: ${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}