diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fc821d7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +node_modules +dist +.env +.env.* +!.env.example +.git +.gitignore +coverage +*.log +Dockerfile +docker-compose.yml + diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f99166d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,40 @@ +kind: pipeline +type: docker +name: build-deploy + +steps: + - name: Build Docker Image + image: plugins/docker + settings: + registry: git.midastix.com + repo: git.midastix.com/ci-docker-repo-user/manicandle-backend + username: + from_secret: docker_username + password: + from_secret: docker_password + tags: + - latest + when: + branch: + - main + event: + - push + + - name: Deploy + image: appleboy/drone-ssh + settings: + host: api.midastix.com + username: manicandle-backend + key: + from_secret: server_ssh_pkey + port: 22 + command_timeout: 3m + script: + - echo "Deploying manicandle-backend" + - sudo /opt/deployable/manicandle-backend/docker/deploy.sh + - echo "Deployment completed" + when: + branch: + - main + event: + - push \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..540b675 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:24.15-alpine + +WORKDIR /app + +RUN corepack enable && corepack prepare pnpm@11.19.0 --activate + +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +COPY prisma ./prisma +COPY prisma.config.ts ./ + +RUN pnpm install --frozen-lockfile + +COPY tsconfig.json tsconfig.build.json ./ +COPY src ./src + +RUN pnpm db:generate +RUN pnpm build + +ENV NODE_ENV=production +ENV PORT=3000 + +EXPOSE 3000 + +CMD ["pnpm", "start"]