mirror of
https://gitlab.com/Bockiii/deemix-docker.git
synced 2024-08-30 17:32:18 +00:00
Merge branch 'static-cleanup' into 'master'
Remove static first. See merge request Bockiii/deemix-docker!18
This commit is contained in:
commit
217d0143b3
@ -1,13 +1,9 @@
|
|||||||
variables:
|
variables:
|
||||||
IMAGE_TAG: latest
|
|
||||||
IMAGE_TAG_TEST: test
|
|
||||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||||
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
|
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
|
||||||
PLATFORMS_TEST: "linux/amd64"
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_COMMIT_SHORT_SHA}/${CI_COMMIT_SHORT_SHA}"
|
||||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/deemix-docker/${CI_COMMIT_SHORT_SHA}"
|
|
||||||
# Docker build will download via this url
|
# Docker build will download via this url
|
||||||
PACKAGE_REGISTRY_URL_STATIC: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/deemix-docker/static"
|
PACKAGE_REGISTRY_URL_STATIC: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/static/static"
|
||||||
ZIP_NAME: "deemix-docker"
|
|
||||||
npm_config_cache: "$CI_PROJECT_DIR/.npm"
|
npm_config_cache: "$CI_PROJECT_DIR/.npm"
|
||||||
PKG_CACHE_PATH: "$CI_PROJECT_DIR/.nodejs-bin"
|
PKG_CACHE_PATH: "$CI_PROJECT_DIR/.nodejs-bin"
|
||||||
YARN_CACHE_FOLDER: "$CI_PROJECT_DIR/.yarn-cache"
|
YARN_CACHE_FOLDER: "$CI_PROJECT_DIR/.yarn-cache"
|
||||||
@ -28,8 +24,17 @@ build-deemix:
|
|||||||
- .nodejs-bin
|
- .nodejs-bin
|
||||||
- .yarn-cache
|
- .yarn-cache
|
||||||
policy: pull-push
|
policy: pull-push
|
||||||
script:
|
|
||||||
|
before_script:
|
||||||
- apt update && apt install -y --no-install-recommends zip git curl jq
|
- apt update && apt install -y --no-install-recommends zip git curl jq
|
||||||
|
# Dropping static first package first
|
||||||
|
- echo get package ID of static
|
||||||
|
- export STATIC_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages" | jq '.[] | select(.name == "static") | .id')
|
||||||
|
- echo $STATIC_ID
|
||||||
|
- |
|
||||||
|
curl --request DELETE --header "PRIVATE-TOKEN: ${PAT_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${STATIC_ID}"
|
||||||
|
|
||||||
|
script:
|
||||||
- git clone --depth=1 https://gitlab.com/RemixDev/deemix-gui.git --recursive src
|
- git clone --depth=1 https://gitlab.com/RemixDev/deemix-gui.git --recursive src
|
||||||
# Patching pkg.targets to our need
|
# Patching pkg.targets to our need
|
||||||
- jq '.pkg.targets = ["node16-linuxstatic-x64","node16-linuxstatic-arm64","node16-linuxstatic-armv7"]' src/server/package.json > tmp.$$.json && mv tmp.$$.json src/server/package.json
|
- jq '.pkg.targets = ["node16-linuxstatic-x64","node16-linuxstatic-arm64","node16-linuxstatic-armv7"]' src/server/package.json > tmp.$$.json && mv tmp.$$.json src/server/package.json
|
||||||
@ -40,7 +45,7 @@ build-deemix:
|
|||||||
- yarn install-all
|
- yarn install-all
|
||||||
- yarn dist-server
|
- yarn dist-server
|
||||||
- ls -al dist/
|
- ls -al dist/
|
||||||
# Upload static
|
# Upload static files (overwritten) per build
|
||||||
- |
|
- |
|
||||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/deemix-server-x64 ${PACKAGE_REGISTRY_URL_STATIC}/deemix-server-linux-amd64
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/deemix-server-x64 ${PACKAGE_REGISTRY_URL_STATIC}/deemix-server-linux-amd64
|
||||||
- |
|
- |
|
||||||
@ -62,11 +67,11 @@ create-release:
|
|||||||
stage: create-release
|
stage: create-release
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
#rules:
|
#rules:
|
||||||
# - if: $CI_COMMIT_SHA
|
# - if: $CI_COMMIT_TAG
|
||||||
script:
|
script:
|
||||||
- export DATE=$(date +%Y%m%d) #Cant tag same twice use $CI_COMMIT_SHA for a while
|
- export DATE=$(date +%Y%m%d) # Cant tag same twice use $CI_COMMIT_SHA for a while
|
||||||
- |
|
- |
|
||||||
release-cli create --name "Release $CI_COMMIT_SHORT_SHA" --tag-name $CI_COMMIT_SHORT_SHA --description "rollback to this version by changing the docker TAG release code above, registry.gitlab.com/bockiii/deemix-docker:TAG" \
|
release-cli create --name "Release $CI_COMMIT_SHORT_SHA" --tag-name $CI_COMMIT_SHORT_SHA --description "rollback to this version by changing the TAG release code above, registry.gitlab.com/bockiii/deemix-docker:TAG" \
|
||||||
--assets-link "{\"name\":\"deemix-server-linux-amd64\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-amd64\"}" \
|
--assets-link "{\"name\":\"deemix-server-linux-amd64\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-amd64\"}" \
|
||||||
--assets-link "{\"name\":\"deemix-server-linux-arm64\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-arm64\"}" \
|
--assets-link "{\"name\":\"deemix-server-linux-arm64\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-arm64\"}" \
|
||||||
--assets-link "{\"name\":\"deemix-server-linux-armv7\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-arm\"}" \
|
--assets-link "{\"name\":\"deemix-server-linux-armv7\",\"url\":\"${PACKAGE_REGISTRY_URL}/deemix-server-linux-arm\"}" \
|
||||||
@ -79,9 +84,7 @@ create-release:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
build-docker-image:
|
build-docker-image:
|
||||||
image: docker:19
|
image: docker:20
|
||||||
#dependencies:
|
|
||||||
# - build-deemix
|
|
||||||
stage: build-docker-image
|
stage: build-docker-image
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
@ -92,8 +95,6 @@ build-docker-image:
|
|||||||
- export DATE=$(date +%Y%m%d)
|
- export DATE=$(date +%Y%m%d)
|
||||||
script:
|
script:
|
||||||
# Download latest buildx bin from github
|
# Download latest buildx bin from github
|
||||||
- export DATE=$(date +%Y%m%d)
|
|
||||||
#Format 20220212
|
|
||||||
- mkdir -p ~/.docker/cli-plugins/
|
- mkdir -p ~/.docker/cli-plugins/
|
||||||
- BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/latest | grep 'linux-amd64' | grep 'href' | sed 's/.*href="/https:\/\/github.com/g; s/amd64".*/amd64/g')
|
- BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/latest | grep 'linux-amd64' | grep 'href' | sed 's/.*href="/https:\/\/github.com/g; s/amd64".*/amd64/g')
|
||||||
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
|
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
|
||||||
@ -104,10 +105,8 @@ build-docker-image:
|
|||||||
# create the multibuilder
|
# create the multibuilder
|
||||||
- docker buildx create --name multibuilder
|
- docker buildx create --name multibuilder
|
||||||
- docker buildx use multibuilder
|
- docker buildx use multibuilder
|
||||||
# build and push, still need fix download url in dockerfile
|
# build and push
|
||||||
- docker buildx build --platform "${PLATFORMS}" --build-arg BUILDDATE=$DATE --build-arg STATIC_URL=$PACKAGE_REGISTRY_URL_STATIC -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA} -t ${CI_REGISTRY_IMAGE} . --push
|
- docker buildx build --platform "${PLATFORMS}" --build-arg BUILDDATE=$DATE --build-arg STATIC_URL=$PACKAGE_REGISTRY_URL_STATIC -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA} -t ${CI_REGISTRY_IMAGE} . --push
|
||||||
# Also can do using date, so we dont dependant on latest, in case application break again.
|
|
||||||
#- docker buildx build --platform "${PLATFORMS}" -t ${CI_REGISTRY_IMAGE}:${DATE} -t $CI_REGISTRY_IMAGE:${IMAGE_TAG} . --push
|
|
||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
- master
|
- master
|
||||||
|
Loading…
Reference in New Issue
Block a user