diff --git a/.drone.yml.disabled b/.drone.yml.disabled new file mode 100644 index 0000000..e2b0e7e --- /dev/null +++ b/.drone.yml.disabled @@ -0,0 +1,59 @@ +--- +kind: pipeline +type: docker +name: CI + +trigger: + branch: + - main + - prod + +steps: + - name: docker + image: docker.iranrepo.ir/plugins/docker:20.14.4 + pull: if-not-exists + privileged: true + settings: + repo: git.d.aiengines.ir/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME} + # cache_from: git.d.aiengines.ir/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}:latest + tags: + - v${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:8} + - latest + purge: false + registry: https://git.d.aiengines.ir + username: + from_secret: registry-user + password: + from_secret: registry-token + + - name: deploy dev + image: docker.iranrepo.ir/appleboy/drone-ssh + pull: if-not-exists + settings: + host: 192.168.130.25 + username: bagher + timeout: 1m + command_timeout: 2m + key: + from_secret: ssh-key + script: + - docker service update -d --image git.d.aiengines.ir/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}:v${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:8} --with-registry-auth ${DRONE_REPO_NAME}_dev + when: + branch: + - main + + - name: deploy prod + image: docker.iranrepo.ir/appleboy/drone-ssh + pull: if-not-exists + settings: + host: 192.168.130.25 + username: bagher + timeout: 1m + command_timeout: 2m + key: + from_secret: ssh-key + script: + - docker service update -d --image git.d.aiengines.ir/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}:v${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:8} --with-registry-auth ${DRONE_REPO_NAME} + when: + branch: + - prod \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9663973 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# syntax=docker/dockerfile:1 + +FROM docker.ibagher.ir/node:22-bullseye-slim AS builder + +WORKDIR /app + +# Increase memory for large builds +ENV NODE_OPTIONS="--max-old-space-size=4096" +ENV NEXT_TELEMETRY_DISABLED=1 + +COPY package.json yarn.lock ./ +RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \ + yarn install + +COPY . . +RUN --mount=type=cache,target=/app/.next/cache \ + yarn build + +FROM docker.ibagher.ir/node:22-bullseye-slim AS runner + +WORKDIR /app +ENV NODE_ENV=production + +# Copy standalone output +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/public ./public + +EXPOSE 3000 + +CMD ["node", "server.js"] \ No newline at end of file