-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Pushing dev releases on addon * adjusted tests
- Loading branch information
1 parent
2c5fc00
commit 535ba6d
Showing
7 changed files
with
177 additions
and
1 deletion.
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,17 @@ | ||
#### Publish tags to docker hub | ||
name: Deploy dev builds to Docker Hub | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
- add_on_build | ||
paths: | ||
- 'src/*' | ||
jobs: | ||
deploy: | ||
name: Deploy addon (dev) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Run deploy script using builder | ||
run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v $(Build.SourcesDirectory)/addon:/data homeassistant/amd64-builder -t /data --all --docker-user $(docker_user) --docker-password $(docker_password) |
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,88 @@ | ||
|
||
ARG BUILD_FROM=hassioaddons/base-amd64:5.0.3 | ||
#ARG BUILD_FROM=alpine | ||
|
||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine as build | ||
|
||
# Avoid warnings by switching to noninteractive | ||
#ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Build arguments | ||
ARG BUILD_ARCH | ||
# Add-on version | ||
ENV ADDON_VERSION 0.0.36 | ||
|
||
# Configure apt and install packages | ||
RUN \ | ||
apk add --no-cache git \ | ||
&& git clone https://github.com/helto4real/netdaemon.git \ | ||
&& cd netdaemon \ | ||
&& git checkout master | ||
|
||
# Build a self contained executable and trim the executable | ||
RUN \ | ||
if [ "${BUILD_ARCH}" = "armhf" ]; then \ | ||
export RID="linux-arm"; \ | ||
elif [ "${BUILD_ARCH}" = "armv7" ]; then \ | ||
export RID="linux-arm"; \ | ||
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \ | ||
export RID="linux-arm"; \ | ||
elif [ "${BUILD_ARCH}" = "amd64" ]; then \ | ||
export RID="linux-musl-x64"; \ | ||
else \ | ||
echo 'NOT VALID BUILD'; exit 1; \ | ||
fi \ | ||
&& \ | ||
cd netdaemon/src/Service/ \ | ||
&& dotnet add package Microsoft.Packaging.Tools.Trimming --version 1.1.0-preview1-26619-01 \ | ||
&& dotnet publish -c Release -o /netdaemon/bin/publish -r $RID /p:TrimUnusedDependencies=true | ||
|
||
# STAGE 2: Include binary in target add-on container | ||
FROM ${BUILD_FROM} AS runtime | ||
|
||
# Build arguments | ||
ARG BUILD_ARCH | ||
|
||
# Copy binary and the config from build container | ||
COPY --from=build /netdaemon/bin/publish /daemon | ||
|
||
COPY install_dotnet_dep.sh /install_dotnet_dep.sh | ||
|
||
# Install .net core runtime deps | ||
RUN chmod +x /install_dotnet_dep.sh && /install_dotnet_dep.sh | ||
|
||
# Configure web servers to bind to port 80 when present | ||
ENV ASPNETCORE_URLS=http://+:80 \ | ||
# Enable detection of running in a container | ||
DOTNET_RUNNING_IN_CONTAINER=true \ | ||
# Set the invariant mode since icu_libs isn't included (see https://github.com/dotnet/announcements/issues/20) | ||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true | ||
|
||
ENV HASS_DAEMONAPPFOLDER /config/netdaemon | ||
|
||
CMD [ "/daemon/Service" ] | ||
|
||
# | ||
# LABEL target docker image | ||
# | ||
ARG BUILD_DATE | ||
ARG BUILD_REF | ||
ARG BUILD_VERSION | ||
|
||
# Labels | ||
LABEL \ | ||
io.hass.name="Netdaemon" \ | ||
io.hass.description="An application daemon for c# and .NET core 3.1" \ | ||
io.hass.arch="${BUILD_ARCH}" \ | ||
io.hass.type="addon" \ | ||
io.hass.version=${BUILD_VERSION} \ | ||
maintainer="Tomas Hellström <tomas.hellstrom@yahoo.se>" \ | ||
org.label-schema.description="Netdaemon, a community add-on written in .NET core 3.1" \ | ||
org.label-schema.build-date=${BUILD_DATE} \ | ||
org.label-schema.name="Netdaemon" \ | ||
org.label-schema.schema-version="1.0" \ | ||
org.label-schema.url="https://addons.community" \ | ||
org.label-schema.usage="https://helto4real.github.io/netdaemon/" \ | ||
org.label-schema.vcs-ref=${BUILD_REF} \ | ||
org.label-schema.vcs-url="https://helto4real.github.io/netdaemon/" \ | ||
org.label-schema.vendor="Community Hass.io Addons" |
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,6 @@ | ||
# NetDaemon addon | ||
|
||
This is the code to build the NetDaemon Home Assistant addon. This is used for the build system. To add the addon to Home Assistant, please use https://... TODO: | ||
|
||
|
||
|
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,9 @@ | ||
{ | ||
"build_from": { | ||
"aarch64": "hassioaddons/debian-base-aarch64:3.0.1", | ||
"amd64": "hassioaddons/base-amd64:7.0.2", | ||
"armhf": "hassioaddons/debian-base-armhf:3.0.1", | ||
"armv7": "hassioaddons/debian-base-armv7:3.0.1" | ||
}, | ||
"args": {} | ||
} |
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,29 @@ | ||
{ | ||
"name": "NetDaemon", | ||
"version": "dev", | ||
"slug": "netdaemon", | ||
"description": "Application daemon written in .NET core 3.1", | ||
"url": "http://netdaemon.xyz", | ||
"startup": "application", | ||
"image": "netdaemon/homeassistant-addon-{arch}", | ||
"arch": [ | ||
"aarch64", | ||
"amd64", | ||
"armhf", | ||
"armv7" | ||
], | ||
"boot": "auto", | ||
"map": [ | ||
"config:rw" | ||
], | ||
"hassio_api": true, | ||
"hassio_role": "default", | ||
"homeassistant_api": true, | ||
"host_network": false, | ||
"options": { | ||
"log_level": "info" | ||
}, | ||
"schema": { | ||
"log_level": "match(^(trace|debug|info|warning|error)$)" | ||
} | ||
} |
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,27 @@ | ||
# Install .net core runtime deps | ||
if [ "$BUILD_ARCH" == 'amd64' ]; then | ||
apk update && | ||
apk add --no-cache \ | ||
ca-certificates \ | ||
krb5-libs \ | ||
libgcc \ | ||
libintl \ | ||
libssl1.1 \ | ||
libstdc++ \ | ||
wget \ | ||
zlib | ||
fi | ||
|
||
# arm 32/64 buster slim | ||
if [ "$BUILD_ARCH" == 'armhf' ] || [ "$BUILD_ARCH" == 'armv7' ] || [ "$BUILD_ARCH" == 'aarch64' ]; then | ||
apt-get update && | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates libc6 \ | ||
libgcc1 \ | ||
libgssapi-krb5-2 \ | ||
libicu63 \ | ||
libssl1.1 \ | ||
libstdc++6 \ | ||
wget \ | ||
zlib1g && rm -rf /var/lib/apt/lists/* | ||
fi |
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