Browse Source

build in docker

Emmanuel Garette 3 months ago
parent
commit
d5aed382bc
3 changed files with 44 additions and 23 deletions
  1. 10
    0
      Dockerfile
  2. 12
    0
      compose.yml
  3. 22
    23
      make_ipk.sh

+ 10
- 0
Dockerfile View File

@@ -0,0 +1,10 @@
1
+FROM debian:latest
2
+
3
+RUN apt update -y && apt install git build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev cmake -y --force-yes
4
+RUN /usr/bin/git clone git://git.openwrt.org/project/usign.git /srv/usign && mkdir -p /srv/usign/build && cd /srv/usign/build && cmake .. && make
5
+RUN mkdir -p /srv/cadoles
6
+COPY make_ipk.sh /srv/cadoles
7
+COPY configure_captive.sh /srv/cadoles
8
+COPY server-linux-arm.tar.gz /srv/cadoles
9
+
10
+CMD ["/srv/cadoles/make_ipk.sh"]

+ 12
- 0
compose.yml View File

@@ -0,0 +1,12 @@
1
+version: '2.2'
2
+services:
3
+  # Conteneur de base utilisé par les services Zéphir
4
+  # Mutualisation pour la construction des conteneurs
5
+  build-quid:
6
+    build:
7
+      context: .
8
+      dockerfile: Dockerfile
9
+    volumes:
10
+      - ./keys:/srv/keys
11
+      - ./depot:/srv/cadoles/depot
12
+

+ 22
- 23
make_ipk.sh View File

@@ -1,30 +1,25 @@
1 1
 #!/bin/bash
2 2
 
3
-set -e
3
+set -ex
4 4
 
5 5
 VERSION="0.0.0-0"
6 6
 ARCH="arm_cortex-a9_vfpv3"
7
-SRC="dl/server-linux-arm.tar.gz"
8
-BUILD_KEY=keysign/cadoles
9
-
10
-
11
-mkdir -p keysign
12
-# install usign for repository sig
13
-if [ ! -d usign ]; then
14
-    rm -rf usign
15
-    apt-get install build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev cmake -y --force-yes
16
-    git clone git://git.openwrt.org/project/usign.git
17
-    mkdir -p  usign/build
18
-    cd usign/build
19
-    cmake ..
20
-    make
21
-    cd -
22
-    usign/build/usign -G -s $BUILD_KEY -p $BUILD_KEY.pub -c "Key for Cadoles repositories"
23
-fi
7
+SRC="server-linux-arm.tar.gz"
8
+BUILD_KEY_DIR=/srv/keys
9
+BUILD_KEY=$BUILD_KEY_DIR/cadoles
10
+
24 11
 
12
+# create Cadoles repository key sign
13
+# file PUB_KEY_NAME must be copied to /etc/opkg/keys/ on openwrt
14
+if [ ! -f /srv/keys/cadoles ]; then
15
+    /srv/usign/build/usign -G -s $BUILD_KEY -p $BUILD_KEY.pub -c "Key for Cadoles repositories"
16
+    PUB_KEY_NAME=$(/srv/usign/build/usign -F -p $BUILD_KEY.pub)
17
+    cp $BUILD_KEY.pub $BUILD_KEY_DIR/$PUB_KEY_NAME
18
+fi
25 19
 
26
-rm -rf depot tmp
27
-mkdir -p depot
20
+# build package
21
+cd /srv/cadoles
22
+rm -rf depot/* tmp
28 23
 mkdir -p tmp/src/opt/quid
29 24
 tar zxf $SRC --strip-components 1 --one-top-level=tmp/src/opt/quid
30 25
 cp -a configure_captive.sh tmp/src/opt/quid
@@ -48,11 +43,15 @@ PKG_NAME=quid_${VERSION}_${ARCH}.ipk
48 43
 tar zcf ../depot/$PKG_NAME debian-binary control.tar.gz data.tar.gz
49 44
 cd ..
50 45
 rm -rf tmp
46
+
47
+# create Packages
51 48
 SUM=$(sha256sum depot/$PKG_NAME | awk '{ print $1 }')
52 49
 echo """${PKG}SHA256sum: $SUM
53 50
 Filename: $PKG_NAME
54 51
 """ > depot/Packages
55
-usign/build/usign -S -m depot/Packages -s $BUILD_KEY;
56
-PUB_KEY_NAME=$(usign/build/usign -F -p $BUILD_KEY.pub)
57
-cp $BUILD_KEY.pub depot/$PUB_KEY_NAME
52
+
53
+# sign Packages with Cadole's key
54
+/srv/usign/build/usign -S -m depot/Packages -s $BUILD_KEY;
55
+
56
+# compress Packages
58 57
 gzip depot/Packages