diff --git a/.github/workflows/deploy-landing.yml b/.github/workflows/deploy-landing.yml new file mode 100644 index 0000000..ce85078 --- /dev/null +++ b/.github/workflows/deploy-landing.yml @@ -0,0 +1,33 @@ +name: Deploy Landing + +on: + push: + paths: + - 'apps/landing/**' # INI BASED ON PATH CHANGES JADI NTAR KALAU ADA PUSH DIISNI OTOMATIS DEPLOY + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Deploy via SSH + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_KEY }} + port: ${{ secrets.SSH_PORT }} + script: | + set -e + if [ ! -d ~/imphnen-frontend-service ]; then + git clone https://github.com/IMPHNEN/imphnen-frontend-service.git ~/imphnen-frontend-service + else + cd ~/imphnen-frontend-service && git pull + fi + echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" > ~/imphnen-frontend-service/apps/landing/.env + docker compose -f ~/imphnen-frontend-service/docker-compose-landing.yml down || true + docker compose -f ~/imphnen-frontend-service/docker-compose-landing.yml build + docker compose -f ~/imphnen-frontend-service/docker-compose-landing.yml up -d + docker image prune -af diff --git a/apps/landing/next.config.js b/apps/landing/next.config.js index 46c7617..6ba3010 100644 --- a/apps/landing/next.config.js +++ b/apps/landing/next.config.js @@ -1,8 +1,10 @@ const { composePlugins, withNx } = require('@nx/next'); +const path = require('path'); /** @type {import('@nx/next/plugins/with-nx').WithNxOptions} */ const nextConfig = { nx: { svgr: false }, + output: 'standalone', }; module.exports = composePlugins(withNx)(nextConfig); diff --git a/docker-compose-landing.yml b/docker-compose-landing.yml new file mode 100644 index 0000000..34feeca --- /dev/null +++ b/docker-compose-landing.yml @@ -0,0 +1,10 @@ +version: '3.8' +services: + landing: + build: + context: . + dockerfile: docker/landing.Dockerfile + ports: + - "3000:3000" + restart: unless-stopped + container_name: landing diff --git a/docker/backoffice.Dockerfile b/docker/backoffice.Dockerfile new file mode 100644 index 0000000..ef68f85 --- /dev/null +++ b/docker/backoffice.Dockerfile @@ -0,0 +1,16 @@ +FROM node:22-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm install + +FROM node:22-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run backoffice:build + +FROM nginx:alpine AS runner +RUN rm -rf /usr/share/nginx/html/* +COPY --from=builder /app/dist/apps/backoffice /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker/dimentorin.Dockerfile b/docker/dimentorin.Dockerfile new file mode 100644 index 0000000..7c832d3 --- /dev/null +++ b/docker/dimentorin.Dockerfile @@ -0,0 +1,16 @@ +FROM node:22-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm install + +FROM node:22-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run dimentorin:build + +FROM nginx:alpine AS runner +RUN rm -rf /usr/share/nginx/html/* +COPY --from=builder /app/dist/apps/dimentorin /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker/gacha.Dockerfile b/docker/gacha.Dockerfile new file mode 100644 index 0000000..0531586 --- /dev/null +++ b/docker/gacha.Dockerfile @@ -0,0 +1,16 @@ +FROM node:22-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm install + +FROM node:22-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run gacha:build + +FROM nginx:alpine AS runner +RUN rm -rf /usr/share/nginx/html/* +COPY --from=builder /app/dist/apps/gacha /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker/landing.Dockerfile b/docker/landing.Dockerfile new file mode 100644 index 0000000..462c476 --- /dev/null +++ b/docker/landing.Dockerfile @@ -0,0 +1,17 @@ +FROM node:22-alpine AS builder +WORKDIR /app + +COPY . . +RUN npm install +RUN npm run landing:build + +FROM node:22-alpine AS runner +WORKDIR /app + +COPY --from=builder /app/dist/apps/landing/.next/standalone . +COPY --from=builder /app/dist/apps/landing/public apps/landing/public +COPY --from=builder /app/dist/apps/landing/.next/static dist/apps/landing/.next/static + +EXPOSE 3000 + +ENTRYPOINT ["node", "apps/landing/server.js"] \ No newline at end of file