added drone and docker
continuous-integration/drone/push Build is failing Details

This commit is contained in:
hardik 2025-07-16 17:07:23 +05:30
parent f2f78814b8
commit 3a17c354f6
2 changed files with 70 additions and 11 deletions

50
.drone.yml Normal file
View File

@ -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

View File

@ -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;"]