Skip to content

feat: using cdn

feat: using cdn #105

Workflow file for this run

name: Build and Publish the Docker Image
on:
push:
branches:
- main
env:
GITHUB_SHA: ${{ github.sha }}
IMAGE: ssr
REGISTRY_HOSTNAME: ghcr.io
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [20]
steps:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build Nuxt App
run: pnpm build
- name: Build Docker Image
run: |
docker build \
-t "$REGISTRY_HOSTNAME"/cytoid/"$IMAGE" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" .
- name: Save Docker Image
run: |
docker save "$REGISTRY_HOSTNAME"/cytoid/"$IMAGE" | gzip > image.tar.gz
- name: Upload Docker Image
uses: actions/upload-artifact@v2
with:
name: docker-image
path: image.tar.gz
- name: Publish Docker Image
run: |
docker push "$REGISTRY_HOSTNAME"/cytoid/"$IMAGE"
- name: Publish
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: cytoid
directory: ./.output/public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}