mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-31 23:46:12 +03:00
Fix docker build (#4906)
We should tag containers locally with git revision, so in case of concurrent builds using same docker, we not mark wrong containers with a new version. Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
6eefe88b60
commit
2abef8b6ec
7
common/scripts/docker_build.sh
Executable file
7
common/scripts/docker_build.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
version=$(git rev-parse HEAD)
|
||||
|
||||
echo "Building version: $version"
|
||||
|
||||
docker build -t "$1" -t "$1:$version" .
|
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
version=$(git describe --tags --abbrev=0)
|
||||
rev_version=$(git rev-parse HEAD)
|
||||
|
||||
if [ "x$2" = "xstaging" ]
|
||||
then
|
||||
@ -9,11 +10,12 @@ then
|
||||
((c++))
|
||||
version="${a[0]}.${a[1]}.${c}-staging"
|
||||
echo "Tagging stating $1 with version ${version}"
|
||||
docker tag "$1" "$1:$version"
|
||||
docker tag "$1:$rev_version" "$1:$version"
|
||||
docker push "$1:$version"
|
||||
else
|
||||
echo "Tagging release $1 with version ${version}"
|
||||
docker tag "$1" "$1:$version"
|
||||
docker tag "$1:$rev_version" "$1:$version"
|
||||
docker tag "$1:$rev_version" "$1:latest"
|
||||
docker push "$1:$version"
|
||||
docker push "$1:latest"
|
||||
fi
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "Tagging release $1 with version $2"
|
||||
docker tag "$1" "$1:$2"
|
||||
docker push "$1:$2"
|
@ -15,7 +15,7 @@
|
||||
"_phase:docker-build": "rushx docker:build",
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --bundle --minify --platform=node --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle/bundle.js",
|
||||
"docker:build": "docker build -t hardcoreeng/tool .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/tool",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
|
||||
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
|
||||
|
@ -15,7 +15,7 @@
|
||||
"_phase:docker-build": "rushx docker:build",
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --bundle --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --minify --platform=node > bundle/bundle.js",
|
||||
"docker:build": "docker build -t hardcoreeng/account .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/account",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/account staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/account",
|
||||
"run-local": "cross-env MONGO_URL=mongodb://localhost:27017 MINIO_ACCESS_KEY=minioadmi MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost SERVER_SECRET='secret' TRANSACTOR_URL=ws://localhost:3333 ts-node src/__start.ts",
|
||||
|
@ -15,7 +15,7 @@
|
||||
"_phase:docker-build": "rushx docker:build",
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/index.ts --bundle --sourcemap=inline --minify --platform=node > bundle/bundle.js",
|
||||
"docker:build": "docker build -t hardcoreeng/backup .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/backup",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/backup staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/backup",
|
||||
"run-local": "cross-env ACCOUNTS_URL=http://localhost:3000/ SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost TRANSACTOR_URL=ws://localhost:3333 BUCKET_NAME=backups INTERVAL=30 ts-node src/index.ts",
|
||||
|
@ -14,7 +14,7 @@
|
||||
"_phase:docker-build": "rushx docker:build",
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --bundle --platform=node --keep-names > bundle/bundle.js",
|
||||
"docker:build": "docker build -t hardcoreeng/collaborator .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/collaborator",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/collaborator staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/collaborator",
|
||||
"run-local": "cross-env MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 SECRET=secret MINIO_ENDPOINT=localhost MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin ts-node src/__start.ts",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --bundle --minify --platform=node --external:sharp > bundle/bundle.js",
|
||||
"package": "rm -rf ./dist && cp -r ../../dev/prod/dist . && cp -r ../../dev/prod/public/* ./dist/ && rm ./dist/config.json",
|
||||
"docker:build": "docker build -t hardcoreeng/front .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/front",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/front staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/front",
|
||||
"docker:tbuild": "docker build -t hardcoreeng/front . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/front",
|
||||
|
@ -15,7 +15,7 @@
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node --external:bufferutil --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle/bundle.js",
|
||||
"bundle:u": "mkdir -p bundle && esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node > bundle/bundle.js && mkdir -p ./dist && cp -r ./node_modules/uWebSockets.js/*.node ./dist",
|
||||
"docker:build": "docker build -t hardcoreeng/transactor .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/transactor",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/transactor staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/transactor",
|
||||
"build:watch": "compile",
|
||||
|
@ -13,7 +13,7 @@
|
||||
"_phase:docker-build": "rushx docker:build",
|
||||
"_phase:docker-staging": "rushx docker:staging",
|
||||
"bundle": "mkdir -p bundle && esbuild src/__start.ts --bundle --platform=node > bundle/bundle.js",
|
||||
"docker:build": "docker build -t hardcoreeng/collaborator .",
|
||||
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/collaborator",
|
||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/collaborator staging",
|
||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/collaborator",
|
||||
"run-local": "cross-env MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 SECRET=secret MINIO_ENDPOINT=localhost MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin ts-node src/__start.ts",
|
||||
|
Loading…
Reference in New Issue
Block a user