-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: sync Vite Modes with
NODE_ENV
- Updated the `build` script in `package.json` to set `--mode` in the `vite build` command to always match `NODE_ENV` (defaults to `production`). - Simplified `.env` to serve primarily as documentation and to provide essential default values. - Renamed `.env.dev` and `.env.prod` to `.env.development` and `.env.production` as Vite doesn't recognize the former. - Added `.env.staging` for easier deployment configuration. - Symlinked `.env.development` to `.env.staging` for quicker development environment setup. - Renamed `VERCEL_PROXIED_API_BASE_URL` to `VITE_VERCEL_PROXIED_API_BASE_URL` for consistency with other variables. - Added support for configuring `NODE_ENV` build argument in `Dockerfile`. - Renamed `.github/workflows/build.yml` to `.github/workflows/publish-docker-image.yml`, Simplified the script, and set the Docker build argument `NODE_ENV=staging`. Fixes #929 Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
- Loading branch information
Showing
13 changed files
with
97 additions
and
115 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
name: Publish Docker image | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- 'docs/**' | ||
jobs: | ||
publish-docker-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{github.token}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
build-args: | | ||
NODE_ENV=staging | ||
push: true | ||
tags: | | ||
ghcr.io/${{github.repository}}:latest |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,18 +1,28 @@ | ||
# Reference src/utils/env.ts | ||
# This file serves primarily as a documentation for the available configuration | ||
# options in the project. Most values are left empty, as actual values should be | ||
# set in the corresponding `.env.[mode]` files. However, for the ones that | ||
# require default values, such as feature flags, they are set here. | ||
|
||
# Casdoor configuration | ||
VITE_CASDOOR_ENDPOINT="https://goplus-casdoor.qiniu.io" | ||
VITE_CASDOOR_CLIENT_ID="389313df51ffd2093b2f" | ||
# Base URL for the spx-backend API. | ||
# | ||
# Required. | ||
VITE_API_BASE_URL="" | ||
|
||
# Used not for authentication, but for fetching user profile | ||
VITE_CASDOOR_ORGANIZATION_NAME="GoPlus" | ||
VITE_CASDOOR_APP_NAME="application_x8aevk" | ||
# Base URL for the spx-backend API, used by Vercel to proxy '/api/(.*)' requests | ||
# with the '/api' prefix stripped. | ||
# | ||
# Required. | ||
VITE_VERCEL_PROXIED_API_BASE_URL="" | ||
|
||
VITE_API_BASE_URL="/api" | ||
# Casdoor configuration. | ||
# | ||
# Required. | ||
VITE_CASDOOR_ENDPOINT="" | ||
VITE_CASDOOR_CLIENT_ID="" | ||
VITE_CASDOOR_APP_NAME="" | ||
VITE_CASDOOR_ORGANIZATION_NAME="" | ||
|
||
# Features control | ||
# Feature flags, all boolean (true/false), with default values set here. | ||
# | ||
# Optional as they have default values. | ||
VITE_DISABLE_AIGC="false" | ||
|
||
# This base URL is used by Vercel to proxy all '/api/(.*)' requests. | ||
# The path prefix '/api' is stripped before forwarding. | ||
VERCEL_PROXIED_API_BASE_URL="https://goplus-builder.qiniu.io/api" |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
.env.staging |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
# Config for env production | ||
|
||
# Casdoor configuration | ||
VITE_API_BASE_URL="/api" | ||
VITE_VERCEL_PROXIED_API_BASE_URL="https://builder-api.goplus.org" | ||
|
||
VITE_CASDOOR_ENDPOINT="https://acc.goplus.org" | ||
VITE_CASDOOR_CLIENT_ID="4ff910257e9cdd89b6b8" | ||
|
||
# Used not for authentication, but for fetching user profile | ||
VITE_CASDOOR_ORGANIZATION_NAME="built-in" | ||
VITE_CASDOOR_APP_NAME="application_stem" | ||
|
||
VITE_API_BASE_URL="https://builder.goplus.org/api" | ||
VITE_CASDOOR_ORGANIZATION_NAME="built-in" |
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,9 @@ | ||
# Config for env staging | ||
|
||
VITE_API_BASE_URL="https://goplus-builder.qiniu.io/api" | ||
VITE_VERCEL_PROXIED_API_BASE_URL="https://goplus-builder.qiniu.io/api" | ||
|
||
VITE_CASDOOR_ENDPOINT="https://goplus-casdoor.qiniu.io" | ||
VITE_CASDOOR_CLIENT_ID="389313df51ffd2093b2f" | ||
VITE_CASDOOR_APP_NAME="application_x8aevk" | ||
VITE_CASDOOR_ORGANIZATION_NAME="GoPlus" |
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 |
---|---|---|
|
@@ -41,4 +41,5 @@ tsconfig.tsbuildinfo | |
!.yarn/versions | ||
|
||
.env.local | ||
.env.*.local | ||
.vercel |
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
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
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