feat: add build via docker

This commit is contained in:
Georg K
2023-01-06 02:30:39 +03:00
parent 03c59fec32
commit 731b58304c
6 changed files with 119 additions and 17 deletions

4
.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
.git/
.idea/
*.md
*.yml

View File

@@ -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

46
Dockerfile_build Normal file
View File

@@ -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

View File

@@ -1 +1,7 @@
# 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
```

49
local-bionic.list Normal file
View File

@@ -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

9
upload.sh Normal file
View File

@@ -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