diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ad158d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +.git +.gitignore +README.md +.env +.DS_Store +*.log \ No newline at end of file diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..76b52dd --- /dev/null +++ b/.drone.yml @@ -0,0 +1,41 @@ +kind: pipeline +type: docker +name: Build Image + +steps: + - name: Build Docker Image + image: plugins/docker + settings: + build_args: + - API_BASE_URL=https://www.skylinebulletin.in/ + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: git.midastix.com/ci-docker-repo-user/skylinebulletin + registry: git.midastix.com + when: + branch: + - main + event: + - push + + - name: Deploy image + image: appleboy/drone-ssh + settings: + host: skylinebulletin.in + username: skylinebulletin + key: + from_secret: server_ssh_pkey + port: 22 + command_timeout: 3m + script: + - echo "Deploying image" + - sudo /opt/deployable/skylinebulletin/docker/deploy.sh + - echo "Completed Deployment" + when: + branch: + - main + event: + - push + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e44c3b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Stage 1: Build +FROM node:20-bullseye AS builder +WORKDIR /app + +# Copy package files and install dependencies +COPY package.json package-lock.json ./ +RUN npm install + +# Copy the rest of the source code +COPY . . + +# Set environment variable for Vite +ENV VITE_API_BASE_URL=https://midastix.com/api + +# Fix permissions for all node_modules binaries and build +RUN chmod -R +x node_modules/.bin/ && \ + npm run build + +# Stage 2: Serve with Node +FROM node:20-bullseye +WORKDIR /app + +RUN npm install -g serve + +# Copy build output from builder +COPY --from=builder /app/dist build + +EXPOSE 3000 +CMD ["serve", "-s", ".", "-l", "3000"] \ No newline at end of file