From b49daa684d3a07e7d05dd7228869851e19e63949 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Wed, 29 Sep 2021 15:20:02 +0200 Subject: [PATCH 1/4] (re-)add gitlab ci pipeline --- .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..38d1e36 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,38 @@ +stages: + - build-project + - build-container + +variables: + KANIKO_BUILD_IMAGENAME: admin-backend + +build-project: + stage: build-project + before_script: [] + script: + - echo "Building app" + - yarn + # - echo "REACT_APP_API_URL=https://oas-api.initdevelopment.com/api/v1" > .env + # - echo "EXTEND_ESLINT=true" >> .env + - yarn build + - mv build web-build + - echo "Build successful" + artifacts: + expire_in: 1 hour + name: web-build + paths: + - web-build + +build-container: + stage: build-container + image: + # We need a shell to provide the registry credentials, so we need to use the + # kaniko debug image (https://github.com/GoogleContainerTools/kaniko#debug-image) + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - cp deployment/Dockerfile web-build + - cp deployment/nginx.conf web-build + - cd web-build + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --cache=true --context ${CI_PROJECT_DIR}/ --dockerfile ${CI_PROJECT_DIR}/web-build/Dockerfile --destination ${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_COMMIT_REF_NAME} + From 3dd1a6544e8a891503fe3e60aa62b2e7d46e1c9a Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Wed, 29 Sep 2021 15:21:45 +0200 Subject: [PATCH 2/4] set image --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38d1e36..e290748 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,8 @@ stages: - build-project - build-container +image: node:14-alpine + variables: KANIKO_BUILD_IMAGENAME: admin-backend @@ -10,7 +12,6 @@ build-project: before_script: [] script: - echo "Building app" - - yarn # - echo "REACT_APP_API_URL=https://oas-api.initdevelopment.com/api/v1" > .env # - echo "EXTEND_ESLINT=true" >> .env - yarn build From 4df0b85cf100a884ca2530a99f92a2bec2f80868 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Wed, 29 Sep 2021 15:23:14 +0200 Subject: [PATCH 3/4] re-add yarn command --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e290748..4d43329 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ build-project: before_script: [] script: - echo "Building app" + - yarn # - echo "REACT_APP_API_URL=https://oas-api.initdevelopment.com/api/v1" > .env # - echo "EXTEND_ESLINT=true" >> .env - yarn build From 33a78aa793e78c17ecb8ca7835791fad78370f14 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Wed, 29 Sep 2021 15:27:55 +0200 Subject: [PATCH 4/4] try different build method --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d43329..17ef198 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ build-project: before_script: [] script: - echo "Building app" - - yarn + - yarn install # - echo "REACT_APP_API_URL=https://oas-api.initdevelopment.com/api/v1" > .env # - echo "EXTEND_ESLINT=true" >> .env - yarn build @@ -36,5 +36,5 @@ build-container: - cp deployment/nginx.conf web-build - cd web-build - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --cache=true --context ${CI_PROJECT_DIR}/ --dockerfile ${CI_PROJECT_DIR}/web-build/Dockerfile --destination ${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_COMMIT_REF_NAME} + - /kaniko/executor --cache=true --context ${CI_PROJECT_DIR}/web-build --destination ${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_COMMIT_REF_NAME}