diff --git a/.github/workflows/boolock-dev-cicd.yml b/.github/workflows/boolock-dev-cicd.yml index 595fdfa..51cd35b 100644 --- a/.github/workflows/boolock-dev-cicd.yml +++ b/.github/workflows/boolock-dev-cicd.yml @@ -2,9 +2,7 @@ name: ci/cd action on: push: - branches: ['dev'] - pull_request: - branches: ['dev'] + branches: ['main'] jobs: build: @@ -42,6 +40,7 @@ jobs: - name: Set FE .env run: | echo "VITE_SERVER_URL=http://localhost:3000" > apps/client/.env + echo "VITE_MIXPANEL_TOKEN=${{ secrets.VITE_MIXPANEL_TOKEN }}" >> apps/client/.env echo "VITE_STATIC_STORAGE_URL=${{ secrets.VITE_STATIC_STORAGE_URL }}" >> apps/client/.env - name: Set Nginx SSL files @@ -98,18 +97,20 @@ jobs: password: ${{ secrets.SSH_PASSWORD }} port: ${{ secrets.SSH_PORT }} script: | - cd boolock/web31-BooLock - git checkout dev - git pull origin dev + cd boolock/refactor-web31-BooLock + git checkout main + git pull origin main echo "MONGO_URI=${{ secrets.DEPLOY_MONGO_URI }}" > apps/server/.env echo "IS_LOCAL=false" >> apps/server/.env - echo "${{ secrets.DEPLOY_SERVER_CORS_ACCEPT }}" >> apps/server/.env + echo "SERVER_CORS_ACCEPT=${{ secrets.DEPLOY_SERVER_CORS_ACCEPT }}" >> apps/server/.env echo "S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }}" >> apps/server/.env echo "S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }}" >> apps/server/.env echo "S3_BUCKET_NAME=${{ secrets.S3_BUCKET_NAME }}" >> apps/server/.env + echo "NODE_ENV=production" >> apps/server/.env echo "VITE_SERVER_URL=${{ secrets.DEPLOY_VITE_SERVER_URL }}" > apps/client/.env + echo "VITE_MIXPANEL_TOKEN=${{ secrets.VITE_MIXPANEL_TOKEN }}" >> apps/client/.env echo "VITE_STATIC_STORAGE_URL=${{ secrets.VITE_STATIC_STORAGE_URL }}" >> apps/client/.env sudo docker compose pull diff --git a/apps/client/Dockerfile b/apps/client/Dockerfile index 5b82913..6f9915d 100644 --- a/apps/client/Dockerfile +++ b/apps/client/Dockerfile @@ -1,19 +1,20 @@ FROM base-image AS frontend-build + WORKDIR /app/apps/client COPY ./apps/client . -COPY --from=base-image /app/packages /app/packages -RUN pnpm install --offline --frozen-lockfile -RUN pnpm run build +RUN pnpm install --offline --frozen-lockfile &&\ + pnpm run build FROM nginx:alpine AS frontend -COPY --from=frontend-build /app/apps/client/dist /usr/share/nginx/html + COPY /apps/client/nginx.conf /etc/nginx/conf.d/default.conf COPY /apps/client/ssl /etc/nginx/ssl +RUN chmod 644 /etc/nginx/ssl/fullchain.pem &&\ + chmod 600 /etc/nginx/ssl/privkey.pem &&\ + chown -R nginx:nginx /usr/share/nginx/html /etc/nginx/ssl -RUN chmod -R 755 /usr/share/nginx/html -RUN chmod 644 /etc/nginx/ssl/fullchain.pem -RUN chmod 600 /etc/nginx/ssl/privkey.pem -RUN chown -R nginx:nginx /usr/share/nginx/html /etc/nginx/ssl +COPY --from=frontend-build /app/apps/client/dist /usr/share/nginx/html/ +RUN chmod -R 755 /usr/share/nginx/html EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/apps/client/index.html b/apps/client/index.html index aaf34e8..ff71a31 100644 --- a/apps/client/index.html +++ b/apps/client/index.html @@ -1,6 +1,16 @@ + + + @@ -14,10 +24,7 @@ - + diff --git a/apps/client/package.json b/apps/client/package.json index ddde07c..62e8d24 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -22,13 +22,13 @@ "codemirror": "^6.0.1", "html2canvas": "^1.4.1", "init": "^0.1.2", + "mixpanel-browser": "^2.58.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-helmet-async": "^2.0.5", "react-hot-toast": "^2.4.1", "react-router-dom": "^6.27.0", "react-spinners": "^0.14.1", - "react-youtube": "^10.1.0", "storybook": "^8.4.1", "uuid": "^11.0.3", "zustand": "^5.0.1" @@ -44,6 +44,7 @@ "@storybook/react": "8.4.2", "@storybook/react-vite": "8.4.2", "@storybook/test": "8.4.2", + "@types/mixpanel-browser": "^2.51.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@types/react-router-dom": "^5.3.3", @@ -55,7 +56,6 @@ "eslint-plugin-react-refresh": "^0.4.14", "eslint-plugin-storybook": "^0.11.0", "postcss": "^8.4.47", - "prop-types": "15.8.1", "tailwindcss": "^3.4.14", "vite": "^5.4.10", "vite-plugin-svgr": "^4.3.0" diff --git a/apps/client/src/app/App.tsx b/apps/client/src/app/App.tsx index 6be0a6f..e0a18ea 100644 --- a/apps/client/src/app/App.tsx +++ b/apps/client/src/app/App.tsx @@ -1,9 +1,10 @@ +import { DelayedFallback, Loading } from '@/shared/ui'; +import { ErrorPage, WorkspaceErrorPage } from '@/pages'; import { RouterProvider, createBrowserRouter } from 'react-router-dom'; -import { ToasterWithMax } from '@/shared/ui'; -import { ErrorPage } from '@/pages/ErrorPage/ErrorPage'; -import { lazy, Suspense } from 'react'; -import { Loading } from '@/shared/ui'; +import { Suspense, lazy } from 'react'; + import { Helmet } from 'react-helmet-async'; +import { ToasterWithMax } from '@/shared/ui'; // lazy 로딩 const HomePage = lazy(() => @@ -47,12 +48,19 @@ const router = createBrowserRouter([ BooLock - 작업 공간 - }> + + + + + } + > ), - errorElement: , + errorElement: , }, { path: '*', diff --git a/apps/client/src/app/main.tsx b/apps/client/src/app/main.tsx index 056e764..9004325 100644 --- a/apps/client/src/app/main.tsx +++ b/apps/client/src/app/main.tsx @@ -6,11 +6,13 @@ import { App } from './App'; import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { HelmetProvider } from 'react-helmet-async'; +import { initMixpanel } from '@/shared/utils'; const container = document.getElementById('root'); const root = createRoot(container!); const queryClient = new QueryClient(); +initMixpanel(); root.render( diff --git a/apps/client/src/entities/workspace/CssCategoryButton/CssCategoryButton.tsx b/apps/client/src/entities/workspace/CssCategoryButton/CssCategoryButton.tsx index 15fceba..2a94421 100644 --- a/apps/client/src/entities/workspace/CssCategoryButton/CssCategoryButton.tsx +++ b/apps/client/src/entities/workspace/CssCategoryButton/CssCategoryButton.tsx @@ -12,6 +12,7 @@ type CssCategoryButtonProps = { */ export const CssCategoryButton = ({ cssCategory }: CssCategoryButtonProps) => { const { selectedCssCategory, setSelectedCssCategory } = useCssPropsStore(); + return (