Update pipeline script
This commit is contained in:
parent
8f76a818c8
commit
38e133a98e
2 changed files with 8 additions and 38 deletions
|
|
@ -8,23 +8,6 @@ pipeline:
|
|||
branch: master
|
||||
|
||||
deploy:
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_host
|
||||
username:
|
||||
from_secret: ssh_username
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port: 2332
|
||||
script:
|
||||
- mkdir -p /home/mnisyif/docker-containers/mnisyif/frontend
|
||||
- rm -rf /home/mnisyif/docker-containers/mnisyif/frontend/*
|
||||
- echo "Copied files to server"
|
||||
when:
|
||||
branch: master
|
||||
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
settings:
|
||||
host:
|
||||
|
|
@ -36,13 +19,12 @@ pipeline:
|
|||
port: 2332
|
||||
target: /home/mnisyif/docker-containers/mnisyif/frontend
|
||||
source:
|
||||
- Dockerfile
|
||||
- dist/**/*
|
||||
- nginx.conf
|
||||
- Dockerfile
|
||||
when:
|
||||
branch: master
|
||||
|
||||
docker-build:
|
||||
docker-build-and-run:
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
|
|
@ -54,14 +36,9 @@ pipeline:
|
|||
port: 2332
|
||||
script:
|
||||
- cd /home/mnisyif/docker-containers/mnisyif/frontend
|
||||
- DOCKER_TAG=$(echo ${CI_COMMIT_SHA} | cut -c1-8)
|
||||
- ls -la # This will list all files in the current directory
|
||||
- cat Dockerfile # This will show the content of the Dockerfile
|
||||
- docker build -t frontend:$DOCKER_TAG .
|
||||
- docker build -t frontend:${CI_COMMIT_SHA} .
|
||||
- docker stop frontend || true
|
||||
- docker rm frontend || true
|
||||
- docker run -d --name frontend -p 5173:5173 frontend:$DOCKER_TAG
|
||||
- docker run -d --name frontend -p 5173:5173 frontend:${CI_COMMIT_SHA}
|
||||
when:
|
||||
branch: master
|
||||
|
||||
branches: master
|
||||
11
Dockerfile
11
Dockerfile
|
|
@ -1,13 +1,6 @@
|
|||
FROM node:22 as build
|
||||
WORKDIR /app
|
||||
RUN npm install -g npm@10.8.2
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Dockerfile
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
COPY dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 5173
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue