stages: - build - predeploy - deploy build_backend: stage: build tags: - ubuntulab01 script: - echo "Deploying code to server..." - docker build -t my_back notes-backend/ only: - temasky-sample03 build_frontend: stage: build tags: - ubuntulab01 script: - echo "Deploying code to server..." - docker build -t my_front notes-app/ only: - temasky-sample03 build_nginx: stage: build tags: - ubuntulab01 script: - echo "Deploying code to server..." - docker build -t my_nginx nginx/ only: - temasky-sample03 delete_old_containers: stage: predeploy tags: - ubuntulab01 script: - echo "Delete old container" - docker rm --force `docker ps -qa` || true create_network: stage: predeploy tags: - ubuntulab01 script: - echo "create network..." - docker network create app || true only: - temasky-sample03 run_backend_container: stage: deploy tags: - ubuntulab01 script: - echo "Running container in the 'app' network..." - docker run -d --name notes-backend --network app my_back only: - temasky-sample03 run_frontend_container: stage: deploy tags: - ubuntulab01 script: - echo "Running container in the 'app' network..." - docker run -d --name notes-app --network app my_front only: - temasky-sample03