diff --git a/.github/workflows/autoReviewers.yml b/.github/workflows/autoReviewers.yml deleted file mode 100644 index fbca91e..0000000 --- a/.github/workflows/autoReviewers.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Review Assign - -on: - pull_request: - types: [opened, ready_for_review] - -jobs: - assign: - runs-on: ubuntu-latest - steps: - - uses: hkusu/review-assign-action@v1 - with: - assignees: ${{ github.actor }} - reviewers: sinji2102, hyeonjin6530, daun-up diff --git a/.github/workflows/autoSync-develop.yml b/.github/workflows/autoSync-develop.yml deleted file mode 100644 index 1df8e65..0000000 --- a/.github/workflows/autoSync-develop.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: (Develop) Synchronize to forked repo -on: - push: - branches: - - develop - -jobs: - sync: - name: Sync forked repo - runs-on: ubuntu-latest - - steps: - - name: Checkout develop - uses: actions/checkout@v4 - with: - token: ${{ secrets.DEV_AUTO_SYNC_TOKEN }} - fetch-depth: 0 - ref: develop - - - name: Add remote-url - run: | - git remote add forked-repo https://hyeonjin6530:${{ secrets.DEV_AUTO_SYNC_TOKEN }}@github.com/hyeonjin6530/billilge-frontend - git config user.name hyeonjin6530 - git config user.email ${{ secrets.DEV_EMAIL }} - - - name: Push changes to forked-repo - run: | - git push -f forked-repo develop - - - name: Clean up - run: | - git remote remove forked-repo diff --git a/.github/workflows/autoSync-main.yml b/.github/workflows/autoSync-main.yml deleted file mode 100644 index f5f1a89..0000000 --- a/.github/workflows/autoSync-main.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: (Main) Synchronize to forked repo -on: - push: - branches: - - main - -jobs: - sync: - name: Sync forked repo - runs-on: ubuntu-latest - - steps: - - name: Checkout main - uses: actions/checkout@v4 - with: - token: ${{ secrets.AUTO_SYNC_TOKEN }} - fetch-depth: 0 - ref: main - - - name: Add remote-url - run: | - git remote add forked-repo https://tnals0924:${{ secrets.AUTO_SYNC_TOKEN }}@github.com/tnals0924/billilge-frontend - git config user.name tnals0924 - git config user.email ${{ secrets.EMAIL }} - - - name: Push changes to forked-repo - run: | - git push -f forked-repo main - - - name: Clean up - run: | - git remote remove forked-repo diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 0000000..efcf325 --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,50 @@ +name: Deploy to Development + +on: + push: + branches: + - develop + +env: + DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/billilge-client + CAPROVER_APP: dev + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + environment: development + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create .env file + run: echo "${{ secrets.DEV_ENV_FILE }}" > .env.production + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ env.DOCKER_IMAGE }}:dev + ${{ env.DOCKER_IMAGE }}:dev-${{ github.sha }} + cache-from: type=gha,scope=dev + cache-to: type=gha,mode=max,scope=dev + + - name: Deploy to CapRover + uses: caprover/deploy-from-github@v1.1.2 + with: + server: ${{ secrets.CAPROVER_SERVER }} + app: ${{ env.CAPROVER_APP }} + token: ${{ secrets.CAPROVER_DEV_APP_TOKEN }} + image: ${{ env.DOCKER_IMAGE }}:dev diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 0000000..cf00e9a --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,51 @@ +name: Deploy to Production + +on: + push: + branches: + - main + +env: + DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/billilge-client + CAPROVER_APP: app + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + environment: production + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create .env file + run: echo "${{ secrets.PROD_ENV_FILE }}" > .env.production + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ env.DOCKER_IMAGE }}:prod + ${{ env.DOCKER_IMAGE }}:prod-${{ github.sha }} + ${{ env.DOCKER_IMAGE }}:latest + cache-from: type=gha,scope=prod + cache-to: type=gha,mode=max,scope=prod + + - name: Deploy to CapRover + uses: caprover/deploy-from-github@v1.1.2 + with: + server: ${{ secrets.CAPROVER_SERVER }} + app: ${{ env.CAPROVER_APP }} + token: ${{ secrets.CAPROVER_PROD_APP_TOKEN }} + image: ${{ env.DOCKER_IMAGE }}:prod diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e5b83fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Build stage +FROM node:20-alpine AS builder +WORKDIR /app + +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile --ignore-scripts + +COPY . . +RUN yarn build + +# Production stage +FROM node:20-alpine AS runner +WORKDIR /app + +ENV NODE_ENV=production + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" + +CMD ["node", "server.js"] diff --git a/next.config.mjs b/next.config.mjs index 997e55c..fd580d6 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -12,6 +12,7 @@ const nextConfig = withPWA({ DB_NAME: process.env.DB_NAME, }, reactStrictMode: true, + output: 'standalone', swcMinify: true, async redirects() { return [ @@ -34,7 +35,7 @@ const nextConfig = withPWA({ images: { domains: [ 'github.com', - 'billilge-resources.s3.us-west-2.amazonaws.com', // S3 이미지 도메인 추가 + 'minio-api.billilge.site', // 파일서버 이미지 도메인 추가 ], dangerouslyAllowSVG: true, contentSecurityPolicy: "default-src 'self'; img-src 'self' data: https:;",