mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
ci: use depot to build docker image (#3116)
This commit is contained in:
parent
de0d22037d
commit
525bd403d5
7 changed files with 63 additions and 7 deletions
|
@ -34,5 +34,4 @@ cache
|
|||
.github
|
||||
.husky
|
||||
.parcel-cache
|
||||
.scripts
|
||||
.vscode
|
||||
|
|
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
|
@ -36,9 +36,6 @@ jobs:
|
|||
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},value=prerelease
|
||||
type=edge
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
|
@ -52,9 +49,14 @@ jobs:
|
|||
username: silverhand-bot
|
||||
password: ${{ secrets.BOT_PAT }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
- name: Setup Depot
|
||||
uses: depot/setup-action@v1
|
||||
|
||||
- name: Build
|
||||
uses: depot/build-push-action@v1
|
||||
with:
|
||||
platforms: linux/amd64, linux/arm64
|
||||
project: g902cp6dvv
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
|
23
.scripts/update-parcelrc.js
Normal file
23
.scripts/update-parcelrc.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { execSync } from 'child_process';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
|
||||
if (!process.arch.startsWith('arm')) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
execSync('rm packages/**/.parcelrc');
|
||||
|
||||
const updateParcelRcArm64 = async (dir) => {
|
||||
const dirents = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
for (const dirent of dirents) {
|
||||
if (dirent.isDirectory()) {
|
||||
await updateParcelRcArm64(path.resolve(dir, dirent.name));
|
||||
} else if (dirent.name === '.parcelrc.arm64') {
|
||||
await fs.rename(path.resolve(dir, dirent.name), path.resolve(dir, '.parcelrc'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await updateParcelRcArm64(path.resolve('packages'));
|
|
@ -14,6 +14,7 @@ RUN apk add --no-cache python3 make g++
|
|||
COPY . .
|
||||
|
||||
# Install dependencies and build
|
||||
RUN node .scripts/update-parcelrc.js
|
||||
RUN pnpm i
|
||||
RUN pnpm -r build
|
||||
|
||||
|
@ -25,7 +26,7 @@ RUN rm -rf node_modules packages/**/node_modules
|
|||
RUN NODE_ENV=production pnpm i
|
||||
|
||||
# Clean up
|
||||
RUN rm -rf .parcel-cache pnpm-*.yaml
|
||||
RUN rm -rf .scripts .parcel-cache pnpm-*.yaml
|
||||
|
||||
# Seal stage
|
||||
FROM node:18-alpine as app
|
||||
|
|
12
packages/console/.parcelrc.arm64
Normal file
12
packages/console/.parcelrc.arm64
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "@parcel/config-default",
|
||||
"optimizers": {
|
||||
// Disable optimizers in arm64 arch https://github.com/parcel-bundler/parcel/issues/7402
|
||||
"*.{jpg,jpeg,png}": []
|
||||
},
|
||||
"transformers": {
|
||||
"**/assets/images/*.svg": [
|
||||
"@parcel/transformer-svg-react"
|
||||
]
|
||||
}
|
||||
}
|
7
packages/demo-app/.parcelrc.arm64
Normal file
7
packages/demo-app/.parcelrc.arm64
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "@parcel/config-default",
|
||||
"optimizers": {
|
||||
// Disable optimizers in arm64 arch https://github.com/parcel-bundler/parcel/issues/7402
|
||||
"*.{jpg,jpeg,png}": []
|
||||
}
|
||||
}
|
12
packages/ui/.parcelrc.arm64
Normal file
12
packages/ui/.parcelrc.arm64
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "@parcel/config-default",
|
||||
"optimizers": {
|
||||
// Disable optimizers in arm64 arch https://github.com/parcel-bundler/parcel/issues/7402
|
||||
"*.{jpg,jpeg,png}": []
|
||||
},
|
||||
"transformers": {
|
||||
"**/assets/icons/*.svg": [
|
||||
"@parcel/transformer-svg-react"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue