Browse Source

Cleanup; build docker container

master
Johann Schmitz 1 year ago
parent
commit
dc3e3327c1
Signed by: ercpe GPG Key ID: A084064277C501ED
  1. 8
      Dockerfile
  2. 22
      Jenkinsfile
  3. 18
      Makefile
  4. 3
      docker/run.sh
  5. 4
      setup.py

8
Dockerfile

@ -0,0 +1,8 @@
FROM python:3.7-slim
ADD docker_hosts/ /app/docker_hosts
ADD docker/run.sh /app
ADD requirements.txt /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["/app/run.sh"]

22
Jenkinsfile

@ -1,22 +0,0 @@
node('docker') {
stage('Checkout') {
git 'https://git.ercpe.de/ercpe/docker-hosts.git'
}
stage('CI') {
docker.withRegistry('https://r.ercpe.de', 'docker-registry') {
docker.image('r.ercpe.de/ercpe/ubuntu-build:latest').inside {
sh "make clean jenkins"
}
}
}
stage('Package') {
docker.withRegistry('https://r.ercpe.de', 'docker-registry') {
docker.image('r.ercpe.de/ercpe/ubuntu-build:latest').inside {
sh "make clean deb"
}
}
}
}

18
Makefile

@ -1,19 +1,6 @@
TARGET?=tests
test:
PYTHONPATH="." python3 tests/ -v
compile:
@echo Compiling python code
python3 -m compileall .
compile_optimized:
@echo Compiling python code optimized
python3 -O -m compileall .
clean:
find -name "*.py?" -delete
rm -rf MANIFEST *.egg-info dist deb_dist *.tar.gz
rm -rf MANIFEST *.egg-info dist build deb_dist *.tar.gz
install_deps:
pip3 install --user -r requirements.txt
@ -21,6 +8,3 @@ install_deps:
deb:
python3 setup.py --command-packages=stdeb.command bdist_deb
#test
jenkins: clean install_deps compile compile_optimized

3
docker/run.sh

@ -0,0 +1,3 @@
#!/bin/bash
echo "$@"
python3 -m docker_hosts "$@"

4
setup.py

@ -6,7 +6,7 @@ from setuptools import setup
setup(
name='docker_hosts',
version="0.1",
version="0.2",
author='Johann Schmitz',
author_email='johann@j-schmitz.net',
description='Dynamically creates /etc/hosts entries for docker containers',
@ -14,6 +14,6 @@ setup(
url='https://git.ercpe.de/ercpe/docker-hosts',
packages=['docker_hosts'],
entry_points = {
'console_scripts': ['docker-hosts=docker_hosts.docker_hosts:main'],
'console_scripts': ['docker-hosts=docker_hosts.__main__'],
}
)
Loading…
Cancel
Save