diff --git a/.woodpecker.yml b/.woodpecker.yml index ec10c73..3529134 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,10 +32,52 @@ # - docker rm frontend || true # - docker run -d --name frontend -p 5137:5137 frontend:latest -pipeline: - deploy: - image: alpine - commands: - - sh ./deploy.sh +# pipeline: +# deploy: +# image: alpine +# commands: +# - sh ./deploy.sh -branches: master \ No newline at end of file +# branches: master + +pipeline: + submodules: + image: alpine/git + commands: + - git submodule update --init --recursive + + build: + image: docker:latest + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - cd frontend + - docker build -t mnisyif-frontend . + # Optionally push to a registry + # - docker tag my-frontend-app my-registry/my-frontend-app:latest + # - docker push my-registry/my-frontend-app:latest + + deploy: + image: appleboy/drone-ssh + environment: + HOST: "10.0.0.2" + USER: "mnisyif" + SSH_KEY: + from_secret: ssh_key + commands: + - apk add --no-cache openssh + - mkdir -p ~/.ssh + - echo "$SSH_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan -H $HOST >> ~/.ssh/known_hosts + - scp frontend/docker-compose.yml $USER@$HOST:/docker-containers/mnisyif + - scp -r frontend/* $USER@$HOST:/docker-containers/mnisyif/frontend/ + # If the image is pushed to a registry, pull it on the deployment server + # - ssh $USER@$HOST "cd /path/to/deployment/directory && docker-compose pull && docker-compose up -d" + # If the image is built locally on the CI server, transfer the image file + # - docker save my-frontend-app | bzip2 | ssh $USER@$HOST 'bunzip2 | docker load' + # - ssh $USER@$HOST "cd /path/to/deployment/directory && docker-compose up -d" + +secrets: + ssh_key: + external: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..03625b2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + frontend: + image: mnisyif-frontend + build: + context: . + dockerfile: Dockerfile + ports: + - "5173:5173" + restart: always \ No newline at end of file