Skip to content

Commit

Permalink
Support codenotary verify/signing (#73)
Browse files Browse the repository at this point in the history
* Support codenotary verify/signing

* Migrate to alpine

* Adjust hadolint

* better cleanup

* fix name

* fix base image name

* Simplify base build (#74)

* Simplify base build

* cleanup
  • Loading branch information
pvizeli authored Mar 22, 2021
1 parent a22d1d2 commit 5dcee1d
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 214 deletions.
3 changes: 2 additions & 1 deletion .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ignored:
- DL3003
- DL3006
- DL3008
- DL3018
70 changes: 40 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
ARG BUILD_FROM
FROM $BUILD_FROM

# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Setup locals
RUN apt-get update && apt-get install -y --no-install-recommends \
jq \
git \
python3-setuptools \
&& rm -rf /var/lib/apt/lists/* \
ENV LANG C.UTF-8

# Install docker
# https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
gpg-agent \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get update && apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io \
&& rm -rf /var/lib/apt/lists/*
ENV \
VCN_OTP_EMPTY=true \
LANG=C.UTF-8

# Setup arm binary support
ARG BUILD_ARCH
RUN if [ "$BUILD_ARCH" != "amd64" ]; then exit 0; else \
apt-get update && apt-get install -y --no-install-recommends \
qemu-user-static \
binfmt-support \
&& rm -rf /var/lib/apt/lists/*; fi
ARG VCN_VERSION

RUN \
set -x \
&& apk add --no-cache \
git \
docker \
&& apk add --no-cache --virtual .build-dependencies \
build-base \
go \
\
&& git clone -b v${VCN_VERSION} --depth 1 \
https://github.com/codenotary/vcn \
&& cd vcn \
\
# Fix: https://github.com/codenotary/vcn/issues/131
&& go get github.com/codenotary/immudb@4cf9e2ae06ac2e6ec98a60364c3de3eab5524757 \
\
&& if [ "${BUILD_ARCH}" = "armhf" ]; then \
GOARM=6 GOARCH=arm go build -o vcn -ldflags="-s -w" ./cmd/vcn; \
elif [ "${BUILD_ARCH}" = "armv7" ]; then \
GOARM=7 GOARCH=arm go build -o vcn -ldflags="-s -w" ./cmd/vcn; \
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \
GOARCH=arm64 go build -o vcn -ldflags="-s -w" ./cmd/vcn; \
elif [ "${BUILD_ARCH}" = "i386" ]; then \
GOARCH=386 go build -o vcn -ldflags="-s -w" ./cmd/vcn; \
elif [ "${BUILD_ARCH}" = "amd64" ]; then \
GOARCH=amd64 go build -o vcn -ldflags="-s -w" ./cmd/vcn; \
else \
exit 1; \
fi \
\
&& rm -rf /root/go /root/.cache \
&& mv vcn /usr/bin/vcn \
\
&& apk del .build-dependencies \
&& rm -rf /usr/src/vcn

COPY builder.sh /usr/bin/

Expand Down
11 changes: 8 additions & 3 deletions build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"image": "homeassistant/{arch}-builder",
"build_from": {
"aarch64": "homeassistant/aarch64-base-ubuntu:18.04",
"armv7": "homeassistant/armv7-base-ubuntu:18.04",
"amd64": "homeassistant/amd64-base-ubuntu:18.04"
"aarch64": "homeassistant/aarch64-base:3.13",
"armv7": "homeassistant/armv7-base:3.13",
"armhf": "homeassistant/armhf-base:3.13",
"amd64": "homeassistant/amd64-base:3.13",
"i386": "homeassistant/i386-base:3.13"
},
"args": {
"VCN_VERSION": "0.9.4"
},
"labels": {
"io.hass.type": "builder"
Expand Down
Loading

0 comments on commit 5dcee1d

Please sign in to comment.