# .woodpecker.yml steps: - name: build-push image: docker when: - branch: master - event: push commands: - docker build . -t "$IMAGE_TAG" - echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" --password-stdin -u "$REGISTRY_USERNAME" - docker push "$IMAGE_TAG" volumes: - /var/run/docker.sock:/var/run/docker.sock secrets: [IMAGE_TAG, REGISTRY, REGISTRY_USERNAME, REGISTRY_PASSWORD] - name: update deployment and reset database image: docker when: - branch: master - event: push commands: - mkdir -p /root/.ssh/ - echo "$SSH_KEY" | tr -d '\r' > /root/.ssh/id_rsa - chmod 600 /root/.ssh/id_rsa - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - ssh root@10.0.10.4 ' cd "${PROJECT_DIR}"; docker-compose down; docker image rm "${IMAGE_TAG}" || true; docker pull "${IMAGE_TAG}:latest"; docker volume rm "${IMAGE_TAG}_db_data" || true; docker compose up -d' secrets: [IMAGE_TAG, SSH_KEY, PROJECT_DIR]