Skip to content

Commit

Permalink
Build deb -package in CircleCI
Browse files Browse the repository at this point in the history
To support other distros, addition to EliotOS, added deb build and
publish steps to CircleCI configs.
  • Loading branch information
ernoaapa committed Apr 15, 2018
1 parent f3fd627 commit e39e5c1
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
- setup_remote_docker

- run: go get github.com/goreleaser/goreleaser
- run: sudo apt-get update && sudo apt-get install -y btrfs-tools libseccomp-dev
- run: ./build/build-containerd-and-runc.sh
- run: goreleaser --snapshot

publish:
Expand All @@ -45,8 +47,19 @@ jobs:
command: |
go get github.com/goreleaser/goreleaser
go get github.com/estesp/manifest-tool
go get github.com/mlafeldt/pkgcloud/...
- run: sudo apt-get update && sudo apt-get install -y btrfs-tools libseccomp-dev
- run: ./build/build-containerd-and-runc.sh
- run: goreleaser
- run: .circleci/scripts/push-docker-manifest.sh $(git describe --tags --always --dirty)
- run:
name: Publish Linux packages
command: |
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_amd64.deb
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_arm64.deb
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_armv6.deb
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_armv7.deb
workflows:
version: 2
Expand Down
32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ builds:
goarch:
- amd64
- arm64
- arm
goarm:
- 6
- 7

env:
- CGO_ENABLED=0

Expand All @@ -17,6 +22,11 @@ builds:
goarch:
- amd64
- arm64
- arm
goarm:
- 6
- 7

env:
- CGO_ENABLED=0

Expand Down Expand Up @@ -57,3 +67,25 @@ dockers:
dockerfile: Dockerfile.eliotd
tag_templates:
- "v{{ .Version }}-arm64"

nfpm:
homepage: http://www.eliot.run
maintainer: Erno Aapa <[email protected]>
description: "Container management system for IoT devices"
license: Apache 2.0
formats:
- deb

# At the moment repositories includes really old version of containerd
# so we bake in the containerd daemon and runc binary
# dependencies:
# - [email protected]
dependencies:
- libseccomp2 #(Actually runc dep)

files:
"build/etc/systemd/system/eliotd.service": "/etc/systemd/system/eliotd.service"
"build/etc/systemd/system/containerd.service": "/etc/systemd/system/containerd.service"
# Built during the build process
"bin/runc": "/usr/local/bin/runc"
"bin/containerd": "/usr/local/bin/containerd"
33 changes: 33 additions & 0 deletions build/build-containerd-and-runc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
#
#

set -eu

CONTAINERD_VERSION="v1.0.3"
RUNC_VERSION="v0.1.1"
BUILD_DIR=/tmp/build
TARGET_DIR=$(pwd)/bin

mkdir -p $TARGET_DIR

# CONTAINERD
echo "Build containerd"
rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR}/src/github.com/containerd/containerd
wget -qO- "https://github.com/containerd/containerd/archive/${CONTAINERD_VERSION}.tar.gz" | tar xvz --strip-components=1 -C ${BUILD_DIR}/src/github.com/containerd/containerd
cd ${BUILD_DIR}/src/github.com/containerd/containerd
# Modify Makefile to have optional VERSION and REVISION
sed -i='' 's/VERSION=/VERSION?=/g' Makefile
sed -i='' 's/REVISION=/REVISION?=/g' Makefile
GOPATH=${BUILD_DIR} VERSION=${CONTAINERD_VERSION} REVISION=unknown make binaries
cp bin/containerd ${TARGET_DIR}
cp bin/ctr ${TARGET_DIR}
cp bin/containerd-shim ${TARGET_DIR}

# RUNC
echo "Build runc"
rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR}/src/github.com/opencontainers/runc
wget -qO- "https://github.com/opencontainers/runc/archive/${RUNC_VERSION}.tar.gz" | tar xvz --strip-components=1 -C ${BUILD_DIR}/src/github.com/opencontainers/runc
cd ${BUILD_DIR}/src/github.com/opencontainers/runc
make
cp runc ${TARGET_DIR}
1 change: 1 addition & 0 deletions build/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Small script to build and update documentation to GitHub Pages
#
set -euo pipefail

rm -rf _book
gitbook install
Expand Down
14 changes: 14 additions & 0 deletions build/etc/systemd/system/containerd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Containerd
Documentation=https://github.com/containerd/containerd
Requires=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/local/bin/containerd
Restart=always
KillMode=process
RestartSec=10

[Install]
WantedBy=default.target
14 changes: 14 additions & 0 deletions build/etc/systemd/system/eliotd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Eliot daemon
Documentation=https://github.com/ernoaapa/eliot
Requires=containerd.target
After=containerd.target

[Service]
ExecStart=/usr/local/bin/eliotd --debug --grpc-api-listen 0.0.0.0:5000
Restart=always
KillMode=process
RestartSec=2

[Install]
WantedBy=default.target
6 changes: 5 additions & 1 deletion examples/hello-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ metadata:
spec:
containers:
- name: "hello-world"
image: "docker.io/eaapa/hello-world:latest"
image: "docker.io/arm32v7/busybox:latest"
args:
- /bin/sh
- -c
- "while true; echo 'Eliot Rocks!'; do sleep 1; done;"

0 comments on commit e39e5c1

Please sign in to comment.