diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7ef5428 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git/ +.idea/ +*.md +*.yml \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc212a6..37c33dc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,23 +3,11 @@ stages: release-deb: stage: release-deb - image: ubuntu:18.04 + image: docker:latest variables: - DEBIAN_FRONTEND: noninteractive - RADIUS_REPO: "https://github.com/FreeRADIUS/freeradius-server.git" - RADIUS_TAG: "v3.2.x" - RLM_RAW_REPO: "https://github.com/jar3b/rlm_raw.git" - RLM_RAW_TAG: "master" + DOCKER_BUILDKIT: 1 script: - - apt-get update - - apt-get install -y devscripts equivs git quilt gcc - - mkdir -p /usr/local/src/repositories && cd /usr/local/src/repositories - - git clone --depth 1 --single-branch --branch ${RADIUS_TAG} ${RADIUS_REPO} - - git clone --depth 1 --single-branch --branch ${RLM_RAW_TAG} ${RLM_RAW_REPO} - - mv rlm_raw/rlm_raw freeradius-server/src/modules - - cd freeradius-server - - git checkout ${RADIUS_TAG} && debian/rules debian/control && echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control - - make -j2 deb - - ls -la .. + - docker build . -t freerad_builder:3.2.x -f Dockerfile_build + - docker run -e DEB_USER=${DEB_USER} -e DEB_PASS="${DEB_PASS}" freerad_builder:3.2.x /bin/bash only: - main \ No newline at end of file diff --git a/Dockerfile_build b/Dockerfile_build new file mode 100644 index 0000000..b0b343f --- /dev/null +++ b/Dockerfile_build @@ -0,0 +1,46 @@ +FROM ubuntu:18.04 + +ARG DEBIAN_FRONTEND=noninteractive +ARG RADIUS_TAG="v3.2.x" + +ENV RADIUS_REPO="https://github.com/FreeRADIUS/freeradius-server.git" +ENV RADIUS_TAG=${RADIUS_TAG} +ENV RLM_RAW_REPO="https://github.com/jar3b/rlm_raw.git" +ENV RLM_RAW_TAG="master" +# +# Install build tools +# + +COPY local-bionic.list /etc/apt/sources.list + +RUN apt-get update && apt-get install -y devscripts equivs git quilt gcc + +# +# Create build directory +# +RUN mkdir -p /usr/local/src/repositories +WORKDIR /usr/local/src/repositories + +RUN git clone --depth 1 --single-branch --branch ${RADIUS_TAG} ${RADIUS_REPO} +RUN git clone --depth 1 --single-branch --branch ${RLM_RAW_TAG} ${RLM_RAW_REPO} +RUN mv rlm_raw/rlm_raw freeradius-server/src/modules + +WORKDIR freeradius-server + +# +# Install build dependencies +# +RUN git checkout ${RADIUS_TAG}; \ + if [ -e ./debian/control.in ]; then \ + debian/rules debian/control; \ + fi; \ + echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control + +# +# Build the server +# +RUN make -j2 deb && ls -la .. + +WORKDIR /usr/local/src/repositories +ADD upload.sh . +RUN chmod a+x upload.sh \ No newline at end of file diff --git a/README.md b/README.md index f586c36..944ce0c 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -# freeradius \ No newline at end of file +# freeradius + +build: +```bash +docker build . -t freerad_builder:3.2.x -f Dockerfile_build +docker run -e DEB_USER=${DEB_USER} DEB_PASS="${DEB_PASS}" freerad_builder:3.2.x ./upload.sh +``` \ No newline at end of file diff --git a/local-bionic.list b/local-bionic.list new file mode 100644 index 0000000..a2f8da0 --- /dev/null +++ b/local-bionic.list @@ -0,0 +1,49 @@ +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. +deb http://mirror.yandex.ru/ubuntu/ bionic main restricted +# deb-src http://mirror.yandex.ru/ubuntu/ bionic main restricted + +## Major bug fix updates produced after the final release of the +## distribution. +deb http://mirror.yandex.ru/ubuntu/ bionic-updates main restricted +# deb-src http://mirror.yandex.ru/ubuntu/ bionic-updates main restricted + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team. Also, please note that software in universe WILL NOT receive any +## review or updates from the Ubuntu security team. +deb http://mirror.yandex.ru/ubuntu/ bionic universe +# deb-src http://mirror.yandex.ru/ubuntu/ bionic universe +deb http://mirror.yandex.ru/ubuntu/ bionic-updates universe +# deb-src http://mirror.yandex.ru/ubuntu/ bionic-updates universe + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team, and may not be under a free licence. Please satisfy yourself as to +## your rights to use the software. Also, please note that software in +## multiverse WILL NOT receive any review or updates from the Ubuntu +## security team. +deb http://mirror.yandex.ru/ubuntu/ bionic multiverse +# deb-src http://mirror.yandex.ru/ubuntu/ bionic multiverse +deb http://mirror.yandex.ru/ubuntu/ bionic-updates multiverse +# deb-src http://mirror.yandex.ru/ubuntu/ bionic-updates multiverse + +## N.B. software from this repository may not have been tested as +## extensively as that contained in the main release, although it includes +## newer versions of some applications which may provide useful features. +## Also, please note that software in backports WILL NOT receive any review +## or updates from the Ubuntu security team. +deb http://mirror.yandex.ru/ubuntu/ bionic-backports main restricted universe multiverse +# deb-src http://mirror.yandex.ru/ubuntu/ bionic-backports main restricted universe multiverse + +## Uncomment the following two lines to add software from Canonical's +## 'partner' repository. +## This software is not part of Ubuntu, but is offered by Canonical and the +## respective vendors as a service to Ubuntu users. +# deb http://archive.canonical.com/ubuntu bionic partner +# deb-src http://archive.canonical.com/ubuntu bionic partner + +deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted +# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted +deb http://security.ubuntu.com/ubuntu/ bionic-security universe +# deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe +deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse +# deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse diff --git a/upload.sh b/upload.sh new file mode 100644 index 0000000..28a133d --- /dev/null +++ b/upload.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e +DEB_REPO=${DEB_REPO:-"https://nexus.connectone.pro/repository/radius/"} + +for file in *.deb +do + curl -u "${DEB_USER}:${DEB_PASS}" -H "Content-Type: multipart/form-data" --data-binary "@./$file" "${DEB_REPO}" +done; # file \ No newline at end of file