diff --git a/.woodpecker.yml b/.woodpecker.yml index c47e251..a00667a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -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 \ No newline at end of file + branch: master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4c27f84..1575a97 100644 --- a/Dockerfile +++ b/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;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"]