From 3a17c354f64e352a97bdca9346e35501feee52a1 Mon Sep 17 00:00:00 2001 From: hardik Date: Wed, 16 Jul 2025 17:07:23 +0530 Subject: [PATCH] added drone and docker --- .drone.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ dockerfile | 31 ++++++++++++++++++++----------- 2 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..659daf25 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,50 @@ +kind: pipeline +name: Build Image + +steps: + # - name: Lint Check + # image: node:21-alpine + # commands: + # - yarn install + # # - yarn lint + + - name: Build Docker Image + image: plugins/docker + settings: + build_args: "API_BASE_URL=https://http://www.sangwaritaxi.com" + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: git.midastix.com/ci-docker-repo-user/sangwaritaxi_website + registry: git.midastix.com + when: + branch: + - main + event: + - push + + - name: Deploy image + image: appleboy/drone-ssh + settings: + host: sangwaritaxi.com + username: sangwaritaxi_website + key: + from_secret: server_ssh_pkey + port: 22 + command_timeout: 3m + script: + - echo "Deploying image" + - sudo /opt/deployable/sangwaritaxi_website/docker/deploy.sh + - echo "Completed Deployment" + when: + branch: + - main + event: + - push +# trigger: +# branch: +# - main +# - feature/env_api_url +# event: +# - push diff --git a/dockerfile b/dockerfile index 6ed0d96d..9e8f4d66 100644 --- a/dockerfile +++ b/dockerfile @@ -1,17 +1,26 @@ -# Use the official Nginx image from Docker Hub -FROM nginx:alpine +FROM node:21-alpine as builder -# Set working directory -WORKDIR /usr/share/nginx/html +ARG API_BASE_URL="https://mfs-api.midastix.com" -# Remove the default Nginx static assets -RUN rm -rf ./* +ENV REACT_APP_API_BASE_URL $API_BASE_URL + +WORKDIR /app + +COPY package.json package.json +COPY yarn.lock yarn.lock + +RUN yarn install --frozen-lockfile -# Copy your HTML, CSS, JS, etc., to the container COPY . . -# Expose port 80 -EXPOSE 80 +RUN yarn build + + +FROM scratch + +WORKDIR /app + +COPY --from=builder /app/build ./build + +CMD ["sh"] -# Start Nginx server -CMD ["nginx", "-g", "daemon off;"]