feat: CI file and docker image

This commit is contained in:
Swann 2020-10-02 18:56:26 +02:00
parent 9966a24b5e
commit 3bc4b20035
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
5 changed files with 46 additions and 1 deletions

View File

@ -1,7 +1,9 @@
stages:
- test
- build
- deploy
include:
- local: .gitlab/ci/test.gitlab-ci.yml
- local: .gitlab/ci/build.gitlab-ci.yml
- local: .gitlab/ci/build.gitlab-ci.yml
- local: .gitlab/ci/deploy.gitlab-ci.yml

View File

@ -0,0 +1,7 @@
build:
stage: build
image: docker:stable
script:
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY

9
scripts/build_image.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
VERSION="$(python get_replication_version.py)"
echo "Building docker image with version ${VERSION}"
docker build --no-cache --build-arg version=${VERSION} -t registry.gitlab.com/slumber/multi-user/multi-user-server:0.1.0 ./docker_server
echo "Pushing to gitlab registry ${VERSION}"
docker push registry.gitlab.com/slumber/multi-user/multi-user-server:0.1.0

View File

@ -0,0 +1,23 @@
# Download base image debian jessie
FROM python:slim
# Infos
LABEL maintainer="Swann Martinez"
LABEL version="0.1.0"
LABEL description="Blender multi-user addon \
dedicated server image."
ARG version=0.0.21a15
# Argument
ENV password='admin'
ENV port=5555
ENV timeout=3000
ENV log_level=INFO
ENV log_file="multiuser_server.log"
#Install replication
RUN pip install replication==$version
# Run the server with parameters
CMD replication.serve -pwd ${password} -p ${port} -t ${timeout} -l ${log_level} -lf ${log_file}

View File

@ -0,0 +1,4 @@
import re
init_py = open("../multi_user/__init__.py").read()
print(re.search("\d+\.\d+\.\d+\w\d+|\d+\.\d+\.\d+", init_py).group(0))