-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from ernoaapa/build-packages
Build deb packages
- Loading branch information
Showing
17 changed files
with
277 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
steps: | ||
- label: Go version | ||
command: go version | ||
|
||
- label: Docker version | ||
command: docker version | ||
|
||
- label: Install tools | ||
command: | ||
- GOPATH=~/go ./build/install-build-tools.sh | ||
|
||
- wait | ||
|
||
- label: Build containerd arm64 deb package | ||
command: | ||
- GOOS=linux GOARCH=arm64 GOOS=linux GOARCH=arm64 ./deps/publish-all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ builds: | |
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
goarm: | ||
- 6 | ||
- 7 | ||
|
||
env: | ||
- CGO_ENABLED=0 | ||
|
||
|
@@ -17,6 +22,11 @@ builds: | |
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
goarm: | ||
- 6 | ||
- 7 | ||
|
||
env: | ||
- CGO_ENABLED=0 | ||
|
||
|
@@ -57,3 +67,20 @@ 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 | ||
|
||
dependencies: | ||
- containerd (>= 1.0.3) | ||
|
||
files: | ||
"build/etc/systemd/system/eliotd.service": "/etc/systemd/system/eliotd.service" | ||
|
||
config_files: | ||
"build/etc/eliotd/config": "/etc/eliotd/config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ELIOT_GRPC_API_LISTEN=0.0.0.0:5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Eliot daemon | ||
Documentation=https://github.com/ernoaapa/eliot | ||
Requires=containerd.service | ||
After=containerd.service | ||
|
||
[Service] | ||
EnvironmentFile=/etc/eliotd/config | ||
ExecStart=/usr/local/bin/eliotd | ||
Restart=always | ||
KillMode=process | ||
RestartSec=2 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
go get -u github.com/goreleaser/goreleaser | ||
# Switch to fixed fork | ||
cd $GOPATH/src/github.com/goreleaser/goreleaser | ||
git remote add ernoaapa https://github.com/ernoaapa/goreleaser.git || true | ||
git fetch ernoaapa | ||
git checkout fix-arm-architecture | ||
GOBIN=$GOPATH/bin go install . | ||
|
||
go get -u github.com/goreleaser/nfpm | ||
# Switch to fixed fork | ||
cd $GOPATH/src/github.com/goreleaser/nfpm | ||
git remote add ernoaapa https://github.com/ernoaapa/nfpm.git || true | ||
git fetch ernoaapa | ||
git checkout fix-arm-architecture | ||
GOBIN=$GOPATH/bin go install ./cmd/nfpm/ | ||
|
||
go get github.com/estesp/manifest-tool | ||
go get github.com/mlafeldt/pkgcloud/... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# DEPS | ||
|
||
This directory contains all scripts to build containerd and runc dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
# | ||
# | ||
|
||
set -eu | ||
|
||
CONTAINERD_VERSION="v1.0.3" | ||
BUILD_DIR=/tmp/build | ||
ELIOT_SRC_DIR=$(pwd) | ||
TARGET_DIR=${ELIOT_SRC_DIR}/dist | ||
GOOS=${GOOS-"linux"} | ||
GOARCH=${GOARCH} # required | ||
GOARM=${GOARM:-""} # optional | ||
|
||
mkdir -p $TARGET_DIR | ||
|
||
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 | ||
|
||
echo "Compile containerd os:${GOOS}, arch:${GOARCH}, variant:${GOARM}" | ||
GOPATH=${BUILD_DIR} VERSION=${CONTAINERD_VERSION} REVISION=unknown make binaries | ||
|
||
cat << EOF > ./nfpm.yaml | ||
name: "containerd" | ||
arch: "${GOARCH}${GOARM:-""}" | ||
platform: "${GOOS}" | ||
version: "${CONTAINERD_VERSION}" | ||
section: "default" | ||
priority: "extra" | ||
depends: | ||
- runc (>=0.1.1) | ||
maintainer: "Erno Aapa <[email protected]>" | ||
description: An open and reliable container runtime | ||
homepage: "https://containerd.io" | ||
license: "Apache 2.0" | ||
bindir: "/usr/local/bin" | ||
files: | ||
./bin/containerd: "/usr/local/bin/containerd" | ||
./bin/ctr: "/usr/local/bin/ctr" | ||
./bin/containerd-shim: "/usr/local/bin/containerd-shim" | ||
${ELIOT_SRC_DIR}/build/etc/systemd/system/containerd.service: "/etc/systemd/system/containerd.service" | ||
EOF | ||
|
||
nfpm pkg --target ${TARGET_DIR}/containerd_${CONTAINERD_VERSION}_${GOOS}_${GOARCH}${GOARM:-""}.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
# | ||
# | ||
|
||
set -eu | ||
|
||
RUNC_VERSION="v0.1.1" | ||
BUILD_DIR=/tmp/build | ||
TARGET_DIR=$(pwd)/dist | ||
GOOS=${GOOS-"linux"} | ||
GOARCH=${GOARCH} # required | ||
GOARM=${GOARM:-""} # optional | ||
|
||
mkdir -p $TARGET_DIR | ||
|
||
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 | ||
|
||
echo "Build runc os:${GOOS}, arch:${GOARCH}, variant:${GOARM}" | ||
GOPATH=${BUILD_DIR} make | ||
|
||
cat << EOF > ./nfpm.yaml | ||
name: "runc" | ||
arch: "${GOARCH}${GOARM:-""}" | ||
platform: "${GOOS}" | ||
version: "${RUNC_VERSION}" | ||
section: "default" | ||
priority: "extra" | ||
depends: | ||
- libseccomp2 | ||
maintainer: "Erno Aapa <[email protected]>" | ||
description: runc is a CLI tool for spawning and running containers according to the OCI specification. | ||
homepage: "https://www.opencontainers.org" | ||
license: "Apache 2.0" | ||
bindir: "/usr/local/bin" | ||
files: | ||
./runc: "/usr/local/bin/runc" | ||
EOF | ||
|
||
nfpm pkg --target ${TARGET_DIR}/runc_${RUNC_VERSION}_${GOOS}_${GOARCH}${GOARM:-""}.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
BASEDIR=$(dirname "$0") | ||
if [ -z ${PACKAGECLOUD_TOKEN+x} ]; then | ||
echo "You must define PACKAGECLOUD_TOKEN environment variable to publish packages" | ||
exit 1 | ||
fi | ||
|
||
rm -rf ./dist | ||
${BASEDIR}/build-containerd.sh | ||
${BASEDIR}/build-runc.sh | ||
|
||
for package in dist/*.deb; do | ||
pkgcloud-push ernoaapa/eliot/raspbian/stretch $package || echo "${package} upload failed. Already uploaded?" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters