-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat-user-manage' of https://github.com/TeamVastsea/klp…
…bbs_survey_frontend into feat-user-manage
- Loading branch information
Showing
5 changed files
with
55 additions
and
18 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 |
---|---|---|
|
@@ -2,9 +2,7 @@ name: CI/CD | |
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "feat-user-manage" | ||
branches: ["main", "feat-user-manage"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
@@ -21,8 +19,8 @@ jobs: | |
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
|
@@ -31,7 +29,7 @@ jobs: | |
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/klpbbs-survey-frontend:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} | ||
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.IMAGE_NAME }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
|
@@ -44,19 +42,19 @@ jobs: | |
- name: Login to ACR | ||
uses: aliyun/acr-login@v1 | ||
with: | ||
login-server: https://registry.cn-guangzhou.aliyuncs.com | ||
username: "${{ secrets.REGISTRY_USERNAME }}" | ||
login-server: https://${{ vars.REGISTRY_ADDRESS }} | ||
username: "${{ vars.REGISTRY_USERNAME }}" | ||
password: "${{ secrets.REGISTRY_PASSWORD }}" | ||
- name: Build and push image | ||
run: | | ||
docker build -t registry.cn-guangzhou.aliyuncs.com/teamvastsea/klpbbs-survey-frontend:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} . | ||
docker push registry.cn-guangzhou.aliyuncs.com/teamvastsea/klpbbs-survey-frontend:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} | ||
docker build -t ${{ vars.REGISTRY_ADDRESS }}/${{ vars.REGISTRY_NAMESPACE }}/${{ vars.IMAGE_NAME }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} . | ||
docker push ${{ vars.REGISTRY_ADDRESS }}/${{ vars.REGISTRY_NAMESPACE }}/${{ vars.IMAGE_NAME }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'user' }} | ||
deploy: | ||
name: Deploy | ||
needs: [build_docker, build_docker_acr] | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' # Only run deploy if on main branch | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: SSH To Host | ||
uses: appleboy/[email protected] | ||
|
@@ -66,5 +64,5 @@ jobs: | |
key: ${{ secrets.SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
cd ${{ secrets.PROJ_PATH }} | ||
cd ${{ secrets.PROJECT_PATH }} | ||
sudo bash ./deploy.sh |
0
LICENCE → LICENSE
100755 → 100644
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
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,10 +1,48 @@ | ||
FROM node:21-alpine3.18 | ||
# syntax=docker.io/docker/dockerfile:1 | ||
|
||
FROM node:23-alpine AS base | ||
|
||
FROM base AS deps | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN \ | ||
if [ -f yarn.lock ]; then yarn run build; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ADD . . | ||
ENV NODE_ENV=production | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
RUN yarn install && \ | ||
yarn build | ||
ENV PORT=3000 | ||
|
||
CMD [ "yarn", "start" ] | ||
ENV HOSTNAME="0.0.0.0" | ||
CMD ["node", "server.js"] |
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