diff --git a/.gitlab/ci/deploy.gitlab-ci.yml b/.gitlab/ci/deploy.gitlab-ci.yml index 87ea4a8..1c1223b 100644 --- a/.gitlab/ci/deploy.gitlab-ci.yml +++ b/.gitlab/ci/deploy.gitlab-ci.yml @@ -3,24 +3,16 @@ deploy: image: slumber/docker-python variables: DOCKER_DRIVER: overlay2 - # Create the certificates inside this directory for both the server - # and client. The certificates used by the client will be created in - # /certs/client so we only need to share this directory with the - # volume mount in `config.toml`. DOCKER_TLS_CERTDIR: "/certs" services: - docker:19.03.12-dind - # variables: - # # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled - # DOCKER_HOST: tcp://docker:2376 - # DOCKER_TLS_CERTDIR: "/certs" - script: - - VERSION="$(python scripts/get_replication_version.py)" - - echo "Building docker image with version ${VERSION}" - - docker build --build-arg version=${VERSION} -t registry.gitlab.com/slumber/multi-user/multi-user-server:0.1.0 ./scripts/docker_server + - RP_VERSION="$(python scripts/get_replication_version.py)" + - VERSION="$(python scripts/get_addon_version.py)" + - echo "Building docker image with replication ${RP_VERSION}" + - docker build --build-arg replication_version=${RP_VERSION} --build-arg version={VERSION} -t registry.gitlab.com/slumber/multi-user/multi-user-server:${VERSION} ./scripts/docker_server - echo "Pushing to gitlab registry ${VERSION}" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker push registry.gitlab.com/slumber/multi-user/multi-user-server:0.1.0 + - docker push registry.gitlab.com/slumber/multi-user/multi-user-server:{VERSION} diff --git a/scripts/docker_server/Dockerfile b/scripts/docker_server/Dockerfile index 04f4c4f..179501f 100644 --- a/scripts/docker_server/Dockerfile +++ b/scripts/docker_server/Dockerfile @@ -1,14 +1,15 @@ # Download base image debian jessie FROM python:slim +ARG replication_version=0.0.21a15 +ARG version=0.1.0 + # Infos LABEL maintainer="Swann Martinez" -LABEL version="0.1.0" +LABEL version=$version LABEL description="Blender multi-user addon \ dedicated server image." -ARG version=0.0.21a15 - # Argument ENV password='admin' ENV port=5555 @@ -17,7 +18,7 @@ ENV log_level=INFO ENV log_file="multiuser_server.log" #Install replication -RUN pip install replication==$version +RUN pip install replication==$replication_version # Run the server with parameters CMD replication.serve -pwd ${password} -p ${port} -t ${timeout} -l ${log_level} -lf ${log_file} diff --git a/scripts/get_addon_version.py b/scripts/get_addon_version.py new file mode 100644 index 0000000..7c25283 --- /dev/null +++ b/scripts/get_addon_version.py @@ -0,0 +1,6 @@ +import re + +init_py = open("multi_user/__init__.py").read() +version = re.search("\d+, \d+, \d+", init_py).group(0) +digits = version.split(',') +print('.'.join(digits).replace(" ","")) \ No newline at end of file