From 288bfed92ec492ceb97f16e46a88252cea932330 Mon Sep 17 00:00:00 2001 From: Fajar Herawan <13521080@std.stei.itb.ac.id> Date: Tue, 28 May 2024 21:05:20 +0000 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a63621..bad4a24 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,20 +21,37 @@ build-job: # This job runs in the build stage, which runs first. - name: 'docker:dind' rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main' - before_script: - - apk add --no-cache curl jq python3 py3-pip - - python3 -m venv awscli-env - - source awscli-env/bin/activate - - pip install awscli - - aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin $DOCKER_REGISTRY - - aws --version - - docker info - - docker --version - - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin script: - - docker build --platform linux/amd64 -t graduit-be-amd -f Dockerfile.production . - - docker tag graduit-be-amd:latest $DOCKER_REGISTRY/graduit-be-amd:latest - - docker push $DOCKER_REGISTRY/graduit-be-amd:latest + - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin + - docker build --platform linux/amd64 -t gitlab.informatika.org:4567/k-01-11/graduit-be -f Dockerfile.production . + - docker push gitlab.informatika.org:4567/k-01-11/graduit-be + + +# build-job: # This job runs in the build stage, which runs first. +# stage: build +# image: docker:latest +# when: on_success +# variables: +# DOCKER_DRIVER: overlay2 +# DOCKER_TLS_CERTDIR: "" +# services: +# - name: 'docker:dind' +# rules: +# - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main' +# before_script: +# - apk add --no-cache curl jq python3 py3-pip +# - python3 -m venv awscli-env +# - source awscli-env/bin/activate +# - pip install awscli +# - aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin $DOCKER_REGISTRY +# - aws --version +# - docker info +# - docker --version +# - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin +# script: +# - docker build --platform linux/amd64 -t graduit-be-amd -f Dockerfile.production . +# - docker tag graduit-be-amd:latest $DOCKER_REGISTRY/graduit-be-amd:latest +# - docker push $DOCKER_REGISTRY/graduit-be-amd:latest deploy-job: stage: deploy -- GitLab