From 8b7f9bccb709b29c8b6735104c740064f67909fd Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 17 Dec 2019 21:13:32 +0200 Subject: [PATCH 1/3] Build with production API_URL --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a3f070..f15681d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,7 @@ ts:build: image: node:12 stage: build script: - - API_URL=http://web.sik.party:8000/api npm run build + - API_URL=https://sika.sik.party/api npm run build # test:unit: # image: node:12 From 04444320a50f4a7d620333f50591175daaca71dc Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 17 Dec 2019 21:32:54 +0200 Subject: [PATCH 2/3] Seperate dev and prod builds --- .gitlab-ci.yml | 25 +++++++++++++++++++++++++ stack-compose.yml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f15681d..8751a51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,6 +32,16 @@ sass:lint: ts:build: image: node:12 stage: build + only: + - master + script: + - API_URL=http://web.sik.party:8000 npm run build + +prod:build: + image: node:12 + stage: build + only: + - production script: - API_URL=https://sika.sik.party/api npm run build @@ -44,6 +54,8 @@ ts:build: test:e2e: image: circleci/node:12-browsers stage: test + only: + - master script: - npm run test:e2e @@ -60,6 +72,19 @@ publish: - docker build . -t "$IMAGE_NAME" - docker push "$IMAGE_NAME" +publish_prod: + stage: publish + image: docker:stable + services: + - docker:stable-dind + only: + - production + script: + - docker info + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - docker build . -t "$IMAGE_NAME":prod + - docker push "$IMAGE_NAME":prod + deploy_dev: stage: deploy image: alpine:latest diff --git a/stack-compose.yml b/stack-compose.yml index 2520368..07f31bc 100644 --- a/stack-compose.yml +++ b/stack-compose.yml @@ -2,7 +2,7 @@ version: '3.4' services: frontend: - image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-frontend:latest + image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-frontend:prod deploy: replicas: 1 restart_policy: From f03577358d34dd2deb5f26693dc0bb89b2bc321a Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 17 Dec 2019 22:05:37 +0200 Subject: [PATCH 3/3] Some API_URL ethnic cleansing --- .deploy_dev.sh | 2 +- .gitlab-ci.yml | 2 +- package.json | 4 ++-- stack-compose.yml | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.deploy_dev.sh b/.deploy_dev.sh index e9d1c6f..5419642 100644 --- a/.deploy_dev.sh +++ b/.deploy_dev.sh @@ -8,7 +8,7 @@ pushd deployment-frontend docker-compose down docker pull "$1" -API_URL=http://web.sik.party:8000/api docker-compose up -d frontend +docker-compose up -d frontend popd diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8751a51..39b3fd2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ ts:build: only: - master script: - - API_URL=http://web.sik.party:8000 npm run build + - API_URL=http://web.sik.party:8000/api npm run build prod:build: image: node:12 diff --git a/package.json b/package.json index 3f6574c..e3c8c79 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "start-prod": "npm run build && npm run serve", "mock-backend": "json-server --watch db.json -H 0.0.0.0 -p 1234", "test": "npm run test:e2e:verbose", - "test:e2e": "API_URL=http://web.sik.party:8000/api npm-run-all -p -r serve test:e2e:testcafe", - "test:e2e:verbose": "API_URL=http://web.sik.party:8000/api npm-run-all -p -r serve test:e2e:testcafe:verbose", + "test:e2e": "npm-run-all -p -r serve test:e2e:testcafe", + "test:e2e:verbose": "npm-run-all -p -r serve test:e2e:testcafe:verbose", "test:e2e:testcafe": "testcafe -S -s 'tests/testcafe/screenshots' --app-init-delay 2000 chrome:headless tests/testcafe", "test:e2e:testcafe:verbose": "testcafe -S -s 'tests/testcafe/screenshots' --app-init-delay 2000 chrome tests/testcafe", "plop": "plop" diff --git a/stack-compose.yml b/stack-compose.yml index 07f31bc..a569c8d 100644 --- a/stack-compose.yml +++ b/stack-compose.yml @@ -11,5 +11,3 @@ services: order: start-first ports: - 3000:3000 - environment: - API_URL: ${API_URL}