Install vcn inside docker container (#2727)

* Install vcn inside docker container

* ditch multistage

* Fix docker file

* fix lint
This commit is contained in:
Pascal Vizeli 2021-03-16 20:31:30 +01:00 committed by GitHub
parent ff4e550ba3
commit b342073ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 7 deletions

View File

@ -1,5 +1,6 @@
ignored:
- DL3018
- DL3003
- DL3006
- DL3013
- DL3018
- SC2155

View File

@ -1,13 +1,18 @@
ARG BUILD_FROM
FROM $BUILD_FROM
FROM ${BUILD_FROM}
ENV \
S6_SERVICES_GRACETIME=10000 \
SUPERVISOR_API=http://localhost
ARG BUILD_ARCH
ARG VCN_VERSION
WORKDIR /usr/src
# Install base
RUN \
apk add --no-cache \
set -x \
&& apk add --no-cache \
eudev \
eudev-libs \
git \
@ -15,10 +20,38 @@ RUN \
libffi \
libpulse \
musl \
openssl
ARG BUILD_ARCH
WORKDIR /usr/src
openssl \
&& apk add --no-cache --virtual .build-dependencies \
build-base \
go \
git \
\
&& 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 \
&& mv vcn /usr/bin/vcn \
\
&& apk del .build-dependencies \
&& rm -rf /usr/src/vcn
# Install requirements
COPY requirements.txt .

View File

@ -7,6 +7,9 @@
"amd64": "homeassistant/amd64-base-python:3.8-alpine3.13",
"i386": "homeassistant/i386-base-python:3.8-alpine3.13"
},
"args": {
"VCN_VERSION": "0.9.4"
},
"labels": {
"io.hass.type": "supervisor"
}