-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #7 from zivillian/docker
add linux and docker support
- Loading branch information
Showing
7 changed files
with
180 additions
and
3 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,4 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [zivillian] | ||
custom: ['https://paypal.me/zivillian'] |
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,40 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get tag | ||
id: repository | ||
run: echo "tag=$(git describe --tags HEAD)" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: zivillian/ora2mqtt | ||
- name: Build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: true | ||
tags: zivillian/ora2mqtt:main | ||
labels: ${{ steps.meta.outputs.labels }} |
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,47 @@ | ||
name: .NET | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: 6.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Publish ora2mqtt Windows | ||
run: dotnet publish -c release -r win-x64 --sc ora2mqtt/ora2mqtt.csproj | ||
- name: Publish ora2mqtt Linux | ||
run: dotnet publish -c release -r linux-x64 --sc ora2mqtt/ora2mqtt.csproj | ||
- name: Publish ora2mqtt Linux ARM | ||
run: dotnet publish -c release -r linux-arm --sc ora2mqtt/ora2mqtt.csproj | ||
- name: Publish ora2mqtt Linux ARM64 | ||
run: dotnet publish -c release -r linux-arm64 --sc ora2mqtt/ora2mqtt.csproj | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ora2mqtt-win-x64 | ||
path: ora2mqtt/bin/release/net6.0/win-x64/publish | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ora2mqtt-linux-x64 | ||
path: ora2mqtt/bin/release/net6.0/linux-x64/publish | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ora2mqtt-linux-arm | ||
path: ora2mqtt/bin/release/net6.0/linux-arm/publish | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ora2mqtt-linux-arm64 | ||
path: ora2mqtt/bin/release/net6.0/linux-arm64/publish |
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,23 @@ | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env | ||
WORKDIR /app | ||
|
||
COPY libgwmapi/ ./libgwmapi/ | ||
COPY ora2mqtt/ ./ora2mqtt/ | ||
ARG TARGETARCH | ||
RUN if [ "$TARGETARCH" = "amd64" ]; then \ | ||
RID=linux-musl-x64 ; \ | ||
elif [ "$TARGETARCH" = "arm64" ]; then \ | ||
RID=linux-musl-arm64 ; \ | ||
elif [ "$TARGETARCH" = "arm" ]; then \ | ||
RID=linux-musl-arm ; \ | ||
fi \ | ||
&& dotnet publish -c Release -o out -r $RID --sc ora2mqtt/ora2mqtt.csproj | ||
COPY openssl.cnf ./out/ | ||
|
||
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine | ||
WORKDIR /app | ||
COPY --from=build-env /app/out . | ||
COPY libgwmapi/Resources/gwm_root.pem /etc/ssl/certs/. | ||
ENV OPENSSL_CONF=/app/openssl.cnf | ||
|
||
ENTRYPOINT ["/app/ora2mqtt", "-c", "/config/ora2mqtt.yml"] |
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,10 @@ | ||
openssl_conf = openssl_init | ||
|
||
[openssl_init] | ||
ssl_conf = ssl_sect | ||
|
||
[ssl_sect] | ||
system_default = system_default_sect | ||
|
||
[system_default_sect] | ||
CipherString = DEFAULT@SECLEVEL=0 |
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 |
---|---|---|
|
@@ -28,6 +28,6 @@ | |
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine(ex.Message); | ||
Console.WriteLine(ex); | ||
return -1; | ||
} |