diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6f87030 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7aac44f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.6-alpine + + +RUN apk --update add git + +WORKDIR /app +ADD requirements.txt . +RUN python3 -m pip install -r requirements.txt + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4d4397c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3.7" + +services: + sync: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./:/app + command: python3 migrate.py + network_mode: host + env_file: .env \ No newline at end of file diff --git a/migrate.py b/migrate.py index 6786d1a..ab76c14 100644 --- a/migrate.py +++ b/migrate.py @@ -19,15 +19,15 @@ ####################### # CONFIG SECTION START ####################### -GITLAB_URL = 'https://gitlab.source.com' -GITLAB_TOKEN = 'gitlab token' +GITLAB_URL = os.getenv('GITLAB_URL', 'https://gitlab.source.com') +GITLAB_TOKEN = os.getenv('GITLAB_TOKEN', 'gitlab token') # needed to clone the repositories, keep empty to try publickey (untested) -GITLAB_ADMIN_USER = 'admin username' -GITLAB_ADMIN_PASS = 'admin password' +GITLAB_ADMIN_USER = os.getenv('GITLAB_ADMIN_USER', 'admin username') +GITLAB_ADMIN_PASS = os.getenv('GITLAB_ADMIN_PASS', 'admin password') -GITEA_URL = 'https://gitea.dest.com' -GITEA_TOKEN = 'gitea token' +GITEA_URL = os.getenv('GITEA_URL','https://gitea.dest.com') +GITEA_TOKEN = os.getenv('GITEA_TOKEN', 'gitea token') ####################### # CONFIG SECTION END ####################### diff --git a/requirements.txt b/requirements.txt index 7a2766e..a75dd0a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ python-gitlab requests python-dateutil +mysql-connector git+https://github.com/h44z/pygitea