From 5138fc8560c61606497cce8a252ffc5437746984 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Mon, 22 Aug 2022 11:04:41 -0400 Subject: [PATCH 1/8] initial implementation of host_core alpine docker Signed-off-by: Brooks Townsend --- host_core/.dockerignore | 11 +++ host_core/Dockerfile | 137 ++++++++++++++++++++++++++++++++++++++ host_core/Makefile | 3 + host_core/mix.exs | 7 +- host_core/mix.lock | 4 +- wasmcloud_host/Dockerfile | 1 + wasmcloud_host/Makefile | 2 +- 7 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 host_core/.dockerignore create mode 100644 host_core/Dockerfile diff --git a/host_core/.dockerignore b/host_core/.dockerignore new file mode 100644 index 00000000..f2cf3a7a --- /dev/null +++ b/host_core/.dockerignore @@ -0,0 +1,11 @@ +_build/ +.elixir_ls/ +deps/ +.git/ +.gitignore +Dockerfile +Makefile +README* +test/ +*/*/target/debug/ +*/*/target/release/ \ No newline at end of file diff --git a/host_core/Dockerfile b/host_core/Dockerfile new file mode 100644 index 00000000..585b6991 --- /dev/null +++ b/host_core/Dockerfile @@ -0,0 +1,137 @@ +# Goal, use docker to build container, pull tarball out of container, voila +## +# STEP 1: Retrieve dependencies (must happen before NIF compilation) +## +FROM elixir:1.13.4-otp-25-alpine AS builder + +ARG MIX_ENV=prod +ENV MIX_ENV=${MIX_ENV} \ + WASMEX_BUILD=true + +WORKDIR /opt/app +COPY ./ ./ + +# Install necessary system dependencies +RUN apk add bash git curl build-base + +# Get Rust for building NIFs (wasmex + hostcore_wasmcloud_native) +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +# Set PATH to include Rust toolchain, enable static compilation +ENV PATH="/root/.cargo/bin:${PATH}" \ + RUSTFLAGS="-C target-feature=-crt-static" + +# This step installs all the build tools we'll need +RUN mix local.rebar --force && \ + mix local.hex --force && \ + mix deps.get && \ + mix release host_core --path /opt/built + +# ## +# # STEP 2: Build distillery release +# ## +# FROM ${BUILDER_IMAGE} AS builder +# # The name of your application/release (required) +# ARG APP_NAME +# # The version of the application we are building (required) +# ARG APP_VSN +# # The environment to build with +# ARG MIX_ENV=release_prod +# # Set this to true if this release is not a Phoenix app +# ARG SKIP_PHOENIX=false +# # Secret key is required +# ARG SECRET_KEY_BASE +# # Flag to include elixir runtime assets +# ARG INCLUDE_ERTS=true +# +# ENV SKIP_PHOENIX=${SKIP_PHOENIX} \ +# APP_NAME=${APP_NAME} \ +# APP_VSN=${APP_VSN} \ +# MIX_ENV=${MIX_ENV} \ +# SECRET_KEY_BASE=${SECRET_KEY_BASE} \ +# INCLUDE_ERTS=${INCLUDE_ERTS} +# +# # By convention, /opt is typically used for applications +# WORKDIR /opt/app +# +# # This copies our app source code into the build container (including compiled NIFs) +# COPY --from=deps-builder /opt/app /opt/app +# +# # Install dependencies for build container. This may be packages like `curl`, `bash`, +# # or even elixir and erlang depending on the base container +# RUN apt update && \ +# DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ +# curl \ +# git \ +# ca-certificates \ +# libssl-dev \ +# pkg-config \ +# inotify-tools \ +# build-essential +# +# # This step installs all the build tools we'll need +# RUN mix local.rebar --force && \ +# mix local.hex --force +# +# RUN ls -R ./host_core/priv/built +# COPY ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so +# COPY ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so +# # Grab platform-specific NIF +# RUN cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so +# WORKDIR ./wasmcloud_host +# RUN mix do deps.compile, compile +# +# RUN mkdir -p /opt/built && \ +# mix distillery.release --verbose && \ +# cp _build/${MIX_ENV}/rel/${APP_NAME}/releases/${APP_VSN}/${APP_NAME}.tar.gz /opt/built && \ +# cd /opt/built && \ +# tar -xzf ${APP_NAME}.tar.gz && \ +# mkdir -p /opt/rel && \ +# mv ${APP_NAME}.tar.gz /opt/rel +# +# ## +# # STEP 3: Build optimized final release image +# ## +# +# # Release image should be the same as the _base container image_ used for the builder. +# # E.g. `elixir:1.13.3-alpine`'s base container image is `alpine:3.15.4' +FROM alpine:3.16 + +WORKDIR /opt/app +# Required for the erlang VM +RUN apk add ncurses libgcc libstdc++ + +COPY --from=builder /opt/built/ . + +# +# ARG APP_NAME +# ENV REPLACE_OS_VARS=true +# +# +# # Install release image dependencies (e.g. `bash` is required to run the script and a `libc` installation is required for the NIFs) +# RUN apt update && \ +# DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ +# ca-certificates \ +# curl \ +# locales \ +# libssl-dev \ +# inotify-tools \ +# procps && \ +# export LANG=en_US.UTF-8 && \ +# echo $LANG UTF-8 > /etc/locale.gen && \ +# locale-gen && \ +# update-locale LANG=$LANG && \ +# rm -rf /var/lib/apt/lists/* +# +# # Prevents unnecessary warning messages about language encoding +# ENV LC_ALL=en_US.UTF-8 +# +# # NATS connection is required and can be overridden +# # Default configuration assumes a NATS container is running named `nats` and available over port 4222 +ARG WASMCLOUD_RPC_HOST=nats +ARG WASMCLOUD_PROV_RPC_HOST=nats +ARG WASMCLOUD_CTL_HOST=nats +ENV WASMCLOUD_RPC_HOST=${WASMCLOUD_RPC_HOST} \ + WASMCLOUD_CTL_HOST=${WASMCLOUD_CTL_HOST} \ + WASMCLOUD_PROV_RPC_HOST=${WASMCLOUD_PROV_RPC_HOST} + +CMD ["/opt/app/bin/host_core", "start"] \ No newline at end of file diff --git a/host_core/Makefile b/host_core/Makefile index 345ad55c..6117b6df 100644 --- a/host_core/Makefile +++ b/host_core/Makefile @@ -28,6 +28,9 @@ help: ## Display this help build: deps ## Compile host_core mix compile +docker-build: ## Compile host_core docker image + docker build -t host_core:alpine . + deps: ## Fetch mix dependencies mix deps.get diff --git a/host_core/mix.exs b/host_core/mix.exs index c8e56253..cb5b4f67 100644 --- a/host_core/mix.exs +++ b/host_core/mix.exs @@ -15,6 +15,9 @@ defmodule HostCore.MixProject do mode: if(Mix.env() == :dev, do: :debug, else: :release) ] ], + releases: [ + host_core: [] + ], dialyzer: [plt_add_deps: :apps_direct] ] end @@ -44,9 +47,7 @@ defmodule HostCore.MixProject do {:timex, "~> 3.7"}, {:jason, "~> 1.2.2"}, {:gnat, "~> 1.5.2"}, - # erlavro isn't used, but this version upgrades dependency of cloudevents 0.4.0 to use rebar3 - {:erlavro, "~> 2.9.7", override: true, manager: :rebar3}, - {:cloudevents, "~> 0.4.0"}, + {:cloudevents, "~> 0.6.1"}, {:uuid, "~> 1.1"}, {:opentelemetry_api, "~> 1.0"}, {:opentelemetry, "~> 1.0", application: false}, diff --git a/host_core/mix.lock b/host_core/mix.lock index 4a14bce0..87b7f98d 100644 --- a/host_core/mix.lock +++ b/host_core/mix.lock @@ -7,7 +7,7 @@ "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "chatterbox": {:hex, :ts_chatterbox, "0.12.0", "4e54f199e15c0320b85372a24e35554a2ccfc4342e0b7cd8daed9a04f9b8ef4a", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "6478c161bc60244f41cd5847cc3accd26d997883e9f7facd36ff24533b2fa579"}, - "cloudevents": {:hex, :cloudevents, "0.4.0", "bf8b38fe530f0507db4e056818c8742fa96daa06367681cb126a782fb4526ba5", [:mix], [{:avrora, "~> 0.11", [hex: :avrora, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.2.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "9a971243124c43302b8a996143cc3f391353abe5a83485c81c92986385d27455"}, + "cloudevents": {:hex, :cloudevents, "0.6.1", "d3f467a615c00712cf3c9632f6d131695fd3e1d29c10477d2d2fbbec06350522", [:mix], [{:avrora, "~> 0.21", [hex: :avrora, repo: "hexpm", optional: true]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "f0055549bc651bd6702347328dd5824d3f08fbf308d2c7212252e34e345bcb9c"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, "credo": {:hex, :credo, "1.6.6", "f51f8d45db1af3b2e2f7bee3e6d3c871737bda4a91bff00c5eec276517d1a19c", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "625520ce0984ee0f9f1f198165cd46fa73c1e59a17ebc520038b8fce056a5bdc"}, @@ -54,7 +54,7 @@ "timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"}, "tls_certificate_check": {:hex, :tls_certificate_check, "1.15.0", "1c0377617a1111000bca3f4cd530b62690c9bd2dc9b868b4459203cd4d7f16ab", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "87fd2e865078fdf8913a8c27bd8fe2be986383e31011f21d7f92cc5f7bc90731"}, "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, - "typed_struct": {:hex, :typed_struct, "0.2.1", "e1993414c371f09ff25231393b6430bd89d780e2a499ae3b2d2b00852f593d97", [:mix], [], "hexpm", "8f5218c35ec38262f627b2c522542f1eae41f625f92649c0af701a6fab2e11b3"}, + "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"}, diff --git a/wasmcloud_host/Dockerfile b/wasmcloud_host/Dockerfile index 9c33abfb..c3429adc 100644 --- a/wasmcloud_host/Dockerfile +++ b/wasmcloud_host/Dockerfile @@ -1,3 +1,4 @@ +#Goal: use docker to build container, pull tarball out of container # NOTE: This docker image must be built from the root of this repository in order to copy `host_core`. # Use the Makefile target `build-image` for best results. diff --git a/wasmcloud_host/Makefile b/wasmcloud_host/Makefile index 08364123..794cf605 100644 --- a/wasmcloud_host/Makefile +++ b/wasmcloud_host/Makefile @@ -42,7 +42,7 @@ deps: ## Fetch mix dependencies release-prod: build cd ../host_core && copy-nif - MIX_ENV=release_prod SECRET_KEY_BASE=$(SECRET_KEY_BASE) mix distillery.release --executable --verbose + MIX_ENV=release_prod SECRET_KEY_BASE=$(SECRET_KEY_BASE) mix distillery.release --verbose esbuild: mix sass default assets/css/app.scss priv/static/assets/app.css From ccfc68e2d8f63d87b788eb1c5f0abf8a8ff7dc0c Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Mon, 22 Aug 2022 16:49:51 -0400 Subject: [PATCH 2/8] experiment with pulling out aarch64 release, host_core progress Signed-off-by: Brooks Townsend --- .github/workflows/release.yml | 23 +++++-- host_core/Dockerfile | 115 +++++++--------------------------- host_core/mix.exs | 3 - wasmcloud_host/Dockerfile | 2 +- 4 files changed, 43 insertions(+), 100 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 377dbfa3..457ea28d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,9 @@ on: jobs: compile-native-nif: + #TODO: revert revert # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} name: Compile wasmcloud_host_core Native NIF env: working-directory: ./host_core/native/hostcore_wasmcloud_native @@ -188,7 +189,8 @@ jobs: path: ${{env.working-directory}}/${{ matrix.distillery-filename }} release-docker: - if: startswith(github.ref, 'refs/tags/') # Only run on tag push + #TODO: revert revert + # if: startswith(github.ref, 'refs/tags/') # Only run on tag push needs: compile-native-nif name: Release Linux Docker Image runs-on: ubuntu-latest @@ -262,7 +264,8 @@ jobs: with: context: . builder: ${{ steps.buildx-builder.outputs.name }} - push: true + # TODO REVERT REVERT + push: false file: ${{env.working-directory}}/Dockerfile platforms: linux/amd64,linux/arm64 build-args: | @@ -277,9 +280,21 @@ jobs: wasmcloud/wasmcloud_host:${{ env.wasmcloud_host_version }} wasmcloud/wasmcloud_host:latest + - name: Retrieve aarch64 tarball + run: | + docker run --rm -p linux/arm64/v8 -iv ${PWD}:/aarch64temp wasmcloud/wasmcloud_host:${{ env.wasmcloud_host_version}} sh -s < /etc/locale.gen && \ -# locale-gen && \ -# update-locale LANG=$LANG && \ -# rm -rf /var/lib/apt/lists/* -# -# # Prevents unnecessary warning messages about language encoding -# ENV LC_ALL=en_US.UTF-8 -# -# # NATS connection is required and can be overridden -# # Default configuration assumes a NATS container is running named `nats` and available over port 4222 +# NATS connection is required and can be overridden +# Default configuration assumes a NATS container is running named `nats` and available over port 4222 ARG WASMCLOUD_RPC_HOST=nats ARG WASMCLOUD_PROV_RPC_HOST=nats ARG WASMCLOUD_CTL_HOST=nats @@ -134,4 +65,4 @@ ENV WASMCLOUD_RPC_HOST=${WASMCLOUD_RPC_HOST} \ WASMCLOUD_CTL_HOST=${WASMCLOUD_CTL_HOST} \ WASMCLOUD_PROV_RPC_HOST=${WASMCLOUD_PROV_RPC_HOST} -CMD ["/opt/app/bin/host_core", "start"] \ No newline at end of file +CMD ["/opt/app/bin/host_core", "foreground"] \ No newline at end of file diff --git a/host_core/mix.exs b/host_core/mix.exs index cb5b4f67..e66efd01 100644 --- a/host_core/mix.exs +++ b/host_core/mix.exs @@ -15,9 +15,6 @@ defmodule HostCore.MixProject do mode: if(Mix.env() == :dev, do: :debug, else: :release) ] ], - releases: [ - host_core: [] - ], dialyzer: [plt_add_deps: :apps_direct] ] end diff --git a/wasmcloud_host/Dockerfile b/wasmcloud_host/Dockerfile index c3429adc..90a35bac 100644 --- a/wasmcloud_host/Dockerfile +++ b/wasmcloud_host/Dockerfile @@ -83,11 +83,11 @@ RUN apt update && \ RUN mix local.rebar --force && \ mix local.hex --force -RUN ls -R ./host_core/priv/built COPY ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so COPY ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so # Grab platform-specific NIF RUN cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so +RUN rm -rf ./host_core/priv/built/x86_64 ./host_core/priv/built/aarch64 ./host_core/priv/native WORKDIR ./wasmcloud_host RUN mix do deps.compile, compile From 384d7a348a8ff061a87d4bc3ecafd413b54e1aaa Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Tue, 23 Aug 2022 09:36:14 -0400 Subject: [PATCH 3/8] build musl nif Signed-off-by: Brooks Townsend moved to otp 25 for host_core Signed-off-by: Brooks Townsend getting closer Signed-off-by: Brooks Townsend no distillery Signed-off-by: Brooks Townsend rustflags Signed-off-by: Brooks Townsend config.toml Signed-off-by: Brooks Townsend cross from main Signed-off-by: Brooks Townsend docker build matrix Signed-off-by: Brooks Townsend correct _ to - Signed-off-by: Brooks Townsend fixedy fix fix Signed-off-by: Brooks Townsend no env in matrix strategy Signed-off-by: Brooks Townsend context Signed-off-by: Brooks Townsend host_core Signed-off-by: Brooks Townsend better Signed-off-by: Brooks Townsend platform and load Signed-off-by: Brooks Townsend no load, 0.57.0 Signed-off-by: Brooks Townsend v1s 2s and 3s Signed-off-by: Brooks Townsend too many v2s Signed-off-by: Brooks Townsend try not using name Signed-off-by: Brooks Townsend install use Signed-off-by: Brooks Townsend only wasmcloud Signed-off-by: Brooks Townsend no nif wait Signed-off-by: Brooks Townsend skippity skip Signed-off-by: Brooks Townsend temporary no wasted actions Signed-off-by: Brooks Townsend real tag Signed-off-by: Brooks Townsend temp comment Signed-off-by: Brooks Townsend login before setup Signed-off-by: Brooks Townsend buildxv2 Signed-off-by: Brooks Townsend ubuntu 22 weeee Signed-off-by: Brooks Townsend os release Signed-off-by: Brooks Townsend does matrix break Signed-off-by: Brooks Townsend exact same Signed-off-by: Brooks Townsend pheenix Signed-off-by: Brooks Townsend ugh Signed-off-by: Brooks Townsend otp 25 Signed-off-by: Brooks Townsend no otp 25 Signed-off-by: Brooks Townsend 1.13.3? Signed-off-by: Brooks Townsend new new Signed-off-by: Brooks Townsend no matrix Signed-off-by: Brooks Townsend back it up Signed-off-by: Brooks Townsend grab from strictly testing Signed-off-by: Brooks Townsend --- .dockerignore | 4 +- .github/workflows/host_core.yml | 211 ++++--- .github/workflows/release.yml | 524 ++++++++++-------- .github/workflows/wasmcloud_host.yml | 207 ++++--- host_core/Dockerfile | 37 +- host_core/Makefile | 55 +- host_core/README.md | 4 +- host_core/mix.exs | 8 +- host_core/mix.lock | 1 - .../hostcore_wasmcloud_native/.cargo/config | 5 + host_core/rel/config.exs | 24 - wasmcloud_host/Dockerfile | 31 +- wasmcloud_host/Makefile | 13 +- wasmcloud_host/chart/Chart.yaml | 4 +- wasmcloud_host/mix.exs | 6 +- wasmcloud_host/mix.lock | 5 +- 16 files changed, 557 insertions(+), 582 deletions(-) diff --git a/.dockerignore b/.dockerignore index 38301430..52d7c43c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,5 +7,5 @@ */Makefile */README* */test/ -*/target/debug/ -*/target/release/ \ No newline at end of file +*/*/*/target/debug/ +*/*/*/target/release/ \ No newline at end of file diff --git a/.github/workflows/host_core.yml b/.github/workflows/host_core.yml index 068bf146..4c0133e8 100644 --- a/.github/workflows/host_core.yml +++ b/.github/workflows/host_core.yml @@ -1,110 +1,101 @@ -name: HostCore Elixir CI - -on: - push: - branches: [main] - pull_request: - branches: [main] - -env: - MIX_ENV: test - working-directory: host_core - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, windows-2019, macos-10.15] - elixir: [1.13.3] - otp: [23, 24] - - name: Build and test - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - name: Set up Visual Studio C++ toolchain for Windows - uses: ilammy/msvc-dev-cmd@v1 - if: ${{ startswith(matrix.os, 'windows') }} - - # Install erlang/OTP and elixir - - name: Install erlang and elixir - if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} - uses: erlef/setup-beam@v1 - with: - otp-version: "=${{ matrix.otp }}" - elixir-version: ${{ matrix.elixir }} - install-hex: true - install-rebar: true - - name: Install erlang and elixir - if: ${{ startswith(matrix.os, 'macos') }} - run: | - brew install erlang - brew install elixir - - - name: Retrieve Mix Dependencies Cache - uses: actions/cache@v2 - id: mix-cache #id to use in retrieve action - with: - path: | - host_core/deps - host_core/_build - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} - - - name: Install Rebar and Hex - working-directory: ${{env.working-directory}} - run: | - mix local.rebar --force - mix local.hex --force - - - name: Install Mix Dependencies - working-directory: ${{env.working-directory}} - if: steps.mix-cache.outputs.cache-hit != 'true' - run: | - mix do deps.get, deps.compile - - - name: Check Formatting - if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns - working-directory: ${{env.working-directory}} - run: mix format --check-formatted - - - name: Run Credo - working-directory: ${{env.working-directory}} - continue-on-error: true # Don't fail entire action with refactoring opportunities for now - run: mix credo --strict - - - name: Determine lattice prefix - if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners - shell: bash - run: echo "wasmcloud_lattice_prefix=$(echo "${{ runner.os }}__${{ matrix.otp }}__${{ matrix.elixir }}__${{ env.working-directory }}" | sed 's/\./_/g')" >> $GITHUB_ENV - - - name: Run Tests - if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners - working-directory: ${{env.working-directory}} - env: - EXTRA_TEST_ARGS: "--timeout 120000" - WASMCLOUD_LATTICE_PREFIX: ${{ env.wasmcloud_lattice_prefix }} - WASMCLOUD_RPC_TIMEOUT_MS: 3000 - MIX_ENV: test - run: make test - - - name: Retrieve PLT Cache - uses: actions/cache@v2 - id: plt-cache - with: - path: host_core/priv/plts - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} - - - name: Create PLTs - working-directory: ${{env.working-directory}} - if: steps.plt-cache.outputs.cache-hit != 'true' - run: | - mkdir -p priv/plts - mix dialyzer --plt - - - name: Run dialyzer - working-directory: ${{env.working-directory}} - continue-on-error: true # Don't fail entire action with dialyzer opportunities for now - run: mix dialyzer --no-check -# Thank you https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions for this action setup +# name: HostCore Elixir CI + +# on: +# push: +# branches: [main] +# pull_request: +# branches: [main] + +# env: +# MIX_ENV: test +# working-directory: host_core + +# jobs: +# build: +# strategy: +# fail-fast: false +# matrix: +# os: [ubuntu-20.04, windows-2019, macos-10.15] +# elixir: [1.13.4] +# otp: [25] + +# name: Build and test +# runs-on: ${{ matrix.os }} + +# steps: +# - uses: actions/checkout@v3 + +# # Install erlang/OTP and elixir +# - name: Install erlang and elixir +# if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} +# uses: erlef/setup-beam@v1 +# with: +# otp-version: "=${{ matrix.otp }}" +# elixir-version: ${{ matrix.elixir }} +# install-hex: true +# install-rebar: true +# - name: Install erlang and elixir +# if: ${{ startswith(matrix.os, 'macos') }} +# run: | +# brew install erlang +# brew install elixir + +# # If dependencies aren't changing, retrieve cache +# - name: Retrieve Mix Dependencies Cache +# uses: actions/cache@v2 +# id: mix-cache #id to use in retrieve action +# with: +# path: | +# host_core/deps +# host_core/_build +# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} + +# - name: Install Rebar and Hex +# working-directory: ${{env.working-directory}} +# run: | +# mix local.rebar --force +# mix local.hex --force +# - name: Install Mix Dependencies +# working-directory: ${{env.working-directory}} +# if: steps.mix-cache.outputs.cache-hit != 'true' +# run: | +# mix do deps.get, deps.compile + +# - name: Check Formatting +# if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns +# working-directory: ${{env.working-directory}} +# run: mix format --check-formatted + +# - name: Run Credo +# working-directory: ${{env.working-directory}} +# continue-on-error: true # Don't fail entire action with refactoring opportunities for now +# run: mix credo --strict + +# - name: Run Tests +# if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners +# working-directory: ${{env.working-directory}} +# env: +# EXTRA_TEST_ARGS: "--timeout 120000" +# WASMCLOUD_RPC_TIMEOUT_MS: 3000 +# MIX_ENV: test +# run: | +# WASMCLOUD_LATTICE_PREFIX=$(echo "${{ runner.os }}__${{ matrix.otp }}__${{ matrix.elixir }}__${{ env.working-directory }}" | sed 's/\./_/g') \ +# make test + +# - name: Retrieve PLT Cache +# uses: actions/cache@v2 +# id: plt-cache +# with: +# path: host_core/priv/plts +# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} +# - name: Create PLTs +# working-directory: ${{env.working-directory}} +# if: steps.plt-cache.outputs.cache-hit != 'true' +# run: | +# mkdir -p priv/plts +# mix dialyzer --plt +# - name: Run dialyzer +# working-directory: ${{env.working-directory}} +# continue-on-error: true # Don't fail entire action with dialyzer opportunities for now +# run: mix dialyzer --no-check +# # Thank you https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions for this action setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 457ea28d..ae7d4618 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,202 +6,207 @@ on: workflow_dispatch: # Allow manual creation of artifacts without a release pull_request: branches: [main] - +env: + otp-version: 25 + elixir-version: 1.13.4 + +# Steps: +# 1. Compile the NIF in parallel +# 2a. Build mix release, copying NIF into the correct location +# 2b. Build docker image, copying NIF into the container +# 3. Create GH release with artifacts jobs: - compile-native-nif: - #TODO: revert revert - # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - name: Compile wasmcloud_host_core Native NIF - env: - working-directory: ./host_core/native/hostcore_wasmcloud_native - artifact-name: hostcore_wasmcloud_native - strategy: - matrix: - target: - - x86_64-unknown-linux-gnu - - aarch64-unknown-linux-gnu - - x86_64-apple-darwin - - x86_64-pc-windows-gnu - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: wasmcloud/common-actions/install-cross@main - - - name: Build native nif - run: | - chmod +x ~/.cargo/bin/cross - cross build --release --target ${{ matrix.target }} - working-directory: ${{ env.working-directory }} - - - name: Upload nif to GH Actions - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.target }} - if-no-files-found: error - path: | - ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.so - ${{ env.working-directory }}/target/${{ matrix.target }}/release/${{ env.artifact-name }}.dll - ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.dylib - - build-distillery-executable: - # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - needs: compile-native-nif - name: Build application release tarballs - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, windows-2019, macos-11] - working-directory: [wasmcloud_host, host_core] - include: - - os: ubuntu-20.04 - rust-target: x86_64-unknown-linux-gnu - distillery-filename: x86_64-linux.tar.gz - working-directory: wasmcloud_host - - os: windows-2019 - rust-target: x86_64-pc-windows-gnu - distillery-filename: x86_64-windows.tar.gz - working-directory: wasmcloud_host - - os: macos-11 - rust-target: x86_64-apple-darwin - distillery-filename: x86_64-macos.tar.gz - working-directory: wasmcloud_host - - os: ubuntu-20.04 - rust-target: x86_64-unknown-linux-gnu - distillery-filename: x86_64-core-linux.tar.gz - working-directory: host_core - - os: windows-2019 - rust-target: x86_64-pc-windows-gnu - distillery-filename: x86_64-core-windows.tar.gz - working-directory: host_core - - os: macos-11 - rust-target: x86_64-apple-darwin - distillery-filename: x86_64-core-macos.tar.gz - working-directory: host_core - runs-on: ${{ matrix.os }} - env: - working-directory: ${{ matrix.working-directory }} - MIX_ENV: release_prod - ERLANG_VERSION: 24 - ELIXIR_VERSION: 1.13.3 - SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} - - steps: - - uses: actions/checkout@v2 - - name: Set up Visual Studio C++ toolchain for Windows - uses: ilammy/msvc-dev-cmd@v1 - if: ${{ startswith(matrix.os, 'windows') }} - - # Install erlang/OTP and elixir - - name: Install erlang and elixir - if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} - uses: erlef/setup-beam@v1 - with: - otp-version: "=24" - elixir-version: "1.13.4" - install-hex: true - install-rebar: true - # Ideally we would use brew here to install, but OTP 25 isn't compatible with distillery - - name: Install erlang and elixir - shell: bash - if: ${{ startswith(matrix.os, 'macos') }} - run: | - git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1 - echo ". $HOME/.asdf/asdf.sh" >> $HOME/.bash_profile - . $HOME/.asdf/asdf.sh - - asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git - asdf install erlang 24.3.4 - asdf global erlang 24.3.4 - asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git - asdf install elixir 1.13.4 - asdf global elixir 1.13.4 - - - name: Determine version - shell: bash - run: echo "wasmcloud_host_version=$(grep '@app_vsn "' ${{env.working-directory}}/mix.exs | cut -d '"' -f2)" > $GITHUB_ENV - - - name: Retrieve Mix Dependencies Cache - if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache - uses: actions/cache@v2 - id: mix-cache #id to use in retrieve action - with: - path: | - ${{ env.working-directory }}/deps - key: ${{ runner.os }}-${{ env.ERLANG_VERSION }}-${{ env.ELIXIR_VERSION }}-mix-${{ hashFiles('${{ env.working-directory }}/mix.exs', '${{ env.working-directory }}/mix.lock') }} - - - name: Install Mix Dependencies - working-directory: ${{env.working-directory}} - shell: bash - run: | - . $HOME/.asdf/asdf.sh || true # Temporary hack until distillery works with OTP 25.0 - mix local.rebar --force - mix local.hex --force - mix deps.get - - # Download the NIF in the path that Rustler expects - - uses: actions/download-artifact@v3 - with: - path: ./host_core/priv/built - name: ${{ matrix.rust-target }} - - # Rustler looks for .so even on Mac - - name: Rename NIF to shared object - if: ${{ startswith(matrix.os, 'macos') }} - working-directory: ./host_core/priv/built - run: | - mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.so - # Rustler looks for .dll on Windows - - name: Rename NIF to shared object - if: ${{ startswith(matrix.os, 'windows') }} - working-directory: ./host_core/priv/built - run: | - mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.dll - - - name: Compile Elixir - working-directory: ${{env.working-directory}} - shell: bash - run: | - . $HOME/.asdf/asdf.sh || true # Temporary hack until distillery works with OTP 25.0 - mix compile - - - name: Compile Phoenix Assets - if: ${{ env.working-directory == 'wasmcloud_host' }} - working-directory: ${{env.working-directory}} - shell: bash - run: | - . $HOME/.asdf/asdf.sh || true # Temporary hack until distillery works with OTP 25.0 - make esbuild - - - name: Create Distillery Release - working-directory: ${{env.working-directory}} - shell: bash - run: | - . $HOME/.asdf/asdf.sh || true # Temporary hack until distillery works with OTP 25.0 - mix distillery.release --verbose - mv _build/${{ env.MIX_ENV }}/rel/${{env.working-directory}}/releases/${{ env.wasmcloud_host_version }}/${{env.working-directory}}.tar.gz ${{ matrix.distillery-filename }} - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.distillery-filename }} - path: ${{env.working-directory}}/${{ matrix.distillery-filename }} - - release-docker: + # compile-native-nif: + # #TODO: revert revert + # # Run on tag push or on manual dispatch. Release will not be created for manual dispatch + # # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + # name: Compile NIFs + # env: + # working-directory: ./host_core/native/hostcore_wasmcloud_native + # artifact-name: hostcore_wasmcloud_native + # strategy: + # matrix: + # target: + # - x86_64-unknown-linux-gnu + # - aarch64-unknown-linux-gnu + # - aarch64-unknown-linux-musl + # - x86_64-apple-darwin + # - x86_64-pc-windows-gnu + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions/checkout@v3 + + # - name: Build native nif + # run: | + # wget https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-gnu.tar.gz + # tar -xf cross-x86_64-unknown-linux-gnu.tar.gz + # chmod +x cross + # ./cross build --release --target ${{ matrix.target }} + # working-directory: ${{ env.working-directory }} + + # - name: Upload nif to GH Actions + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.target }} + # if-no-files-found: error + # path: | + # ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.so + # ${{ env.working-directory }}/target/${{ matrix.target }}/release/${{ env.artifact-name }}.dll + # ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.dylib + + # create-mix-releases: + # # Run on tag push or on manual dispatch. Release will not be created for manual dispatch + # # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + # needs: compile-native-nif + # name: Mix release + # strategy: + # fail-fast: false + # matrix: + # os: [ubuntu-20.04, windows-2019, macos-11] + # working-directory: [wasmcloud_host, host_core] + # include: + # - os: ubuntu-20.04 + # rust-target: x86_64-unknown-linux-gnu + # release-tarball: x86_64-linux.tar.gz + # working-directory: wasmcloud_host + # - os: windows-2019 + # rust-target: x86_64-pc-windows-gnu + # release-tarball: x86_64-windows.tar.gz + # working-directory: wasmcloud_host + # - os: macos-11 + # rust-target: x86_64-apple-darwin + # release-tarball: x86_64-macos.tar.gz + # working-directory: wasmcloud_host + # - os: ubuntu-20.04 + # rust-target: x86_64-unknown-linux-gnu + # release-tarball: x86_64-linux-core.tar.gz + # working-directory: host_core + # - os: windows-2019 + # rust-target: x86_64-pc-windows-gnu + # release-tarball: x86_64-windows-core.tar.gz + # working-directory: host_core + # - os: macos-11 + # rust-target: x86_64-apple-darwin + # release-tarball: x86_64-macos-core.tar.gz + # working-directory: host_core + # runs-on: ${{ matrix.os }} + # env: + # working-directory: ${{ matrix.working-directory }} + # MIX_ENV: release_prod + # SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} + + # steps: + # - uses: actions/checkout@v3 + + # # Install erlang/OTP and elixir + # - name: Install erlang and elixir + # if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} + # uses: erlef/setup-beam@v1 + # with: + # otp-version: "=${{ env.otp-version }}" + # elixir-version: "${{ env.elixir-version }}" + # install-hex: true + # install-rebar: true + # - name: Install erlang and elixir + # if: ${{ startswith(matrix.os, 'macos') }} + # run: | + # brew install erlang + # brew install elixir + + # - name: Retrieve Mix Dependencies Cache + # if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache + # uses: actions/cache@v2 + # id: mix-cache #id to use in retrieve action + # with: + # path: | + # ${{ env.working-directory }}/deps + # key: ${{ runner.os }}-${{ env.ERLANG_VERSION }}-${{ env.ELIXIR_VERSION }}-mix-${{ hashFiles('${{ env.working-directory }}/mix.exs', '${{ env.working-directory }}/mix.lock') }} + + # - name: Install Mix Dependencies + # working-directory: ${{env.working-directory}} + # shell: bash + # run: | + # mix local.rebar --force + # mix local.hex --force + # mix deps.get + + # # Download the NIF in the path that Rustler expects + # - uses: actions/download-artifact@v3 + # with: + # path: ./host_core/priv/built + # name: ${{ matrix.rust-target }} + # # Rustler looks for .so, even on Mac + # - name: Rename NIF to shared object + # if: ${{ startswith(matrix.os, 'macos') }} + # working-directory: ./host_core/priv/built + # run: | + # mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.so + # # Rustler looks for .dll on Windows + # - name: Rename NIF to shared object + # if: ${{ startswith(matrix.os, 'windows') }} + # working-directory: ./host_core/priv/built + # run: | + # mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.dll + + # - name: Compile Elixir + # working-directory: ${{env.working-directory}} + # shell: bash + # run: | + # mix compile + + # - name: Compile Phoenix Assets + # if: ${{ env.working-directory == 'wasmcloud_host' }} + # working-directory: ${{env.working-directory}} + # shell: bash + # run: | + # make esbuild + + # - name: Create Mix Release + # working-directory: ${{env.working-directory}} + # shell: bash + # run: | + # mix release + # cd _build/${{ env.MIX_ENV }}/rel/${{env.working-directory}} + # ls -lah + # tar -czvf ${{ matrix.release-tarball }} bin erts-* lib releases + # ls -lah + # mv ${{ matrix.release-tarball }} ../../../../ + + # - name: Upload artifact + # uses: actions/upload-artifact@v2 + # with: + # name: ${{ matrix.release-tarball }} + # path: ${{env.working-directory}}/${{ matrix.release-tarball }} + + release-hostcore-docker: #TODO: revert revert # if: startswith(github.ref, 'refs/tags/') # Only run on tag push - needs: compile-native-nif - name: Release Linux Docker Image - runs-on: ubuntu-latest + # needs: compile-native-nif + name: Release Image (host_core) + runs-on: ubuntu-22.04 env: MIX_ENV: release_prod working-directory: wasmcloud_host SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} - + app-name: host_core + arm-tarball: aarch64-linux-musl-core.tar.gz + builder-image: elixir:1.13.4-otp-25-alpine + release-image: alpine:3.16 steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Determine version + run: echo "app-version=$(grep '@app_vsn "' ${{env.working-directory}}/mix.exs | cut -d '"' -f2)" > $GITHUB_ENV + + # Download the NIF in the path that Docker expects for x86 + # - uses: actions/download-artifact@v3 + # with: + # path: ./host_core/priv/built/x86_64 + # name: x86_64-unknown-linux-gnu + # # Download the NIF in the path that Docker expects for aarch64 + # - uses: actions/download-artifact@v3 + # with: + # path: ./host_core/priv/built/aarch64 + # name: aarch64-unknown-linux-gnu - name: Login to AzureCR uses: azure/docker-login@v1 @@ -209,39 +214,84 @@ jobs: login-server: ${{ secrets.AZURECR_PUSH_URL }} username: ${{ secrets.AZURECR_PUSH_USER }} password: ${{ secrets.AZURECR_PUSH_PASSWORD }} - - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_PUSH_USER }} password: ${{ secrets.DOCKERHUB_PUSH_PASSWORD }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 id: buildx-builder + - name: Build and release docker image + uses: docker/build-push-action@v3 + with: + builder: ${{ steps.buildx-builder.outputs.name }} + push: true + context: ${{ env.app-name}}/ + file: ${{ env.app-name}}/Dockerfile + platforms: linux/amd64,linux/arm64 + build-args: | + BUILDER_IMAGE=${{ env.builder-image }} + RELEASE_IMAGE=${{ env.release-image }} + APP_NAME=${{ env.app-name }} + APP_VSN=${{ env.app-version }} + MIX_ENV=${{ env.MIX_ENV }} + tags: | + wasmcloud.azurecr.io/strictlytesting${{ env.app-name }}:${{ env.app-version }} + # docker run --rm --platform linux/arm64/v8 -iv ${PWD}:/aarch64temp wasmcloud/${{ env.app-name }}:${{ env.app-version}} sh -s < $GITHUB_ENV + run: echo "app-version=$(grep '@app_vsn "' ${{env.working-directory}}/mix.exs | cut -d '"' -f2)" > $GITHUB_ENV - # Install erlang/OTP and elixir + # Compile phoenix assets for wasmcloud_host outside of image (dart-sass doesn't support arm linux) - name: Install erlang and elixir uses: erlef/setup-beam@v1 with: - otp-version: "=24" - elixir-version: "1.13.3" + otp-version: "=${{ env.otp-version }}" + elixir-version: "${{ env.elixir-version }}" install-hex: true install-rebar: true - - name: Install Mix Dependencies working-directory: ${{env.working-directory}} run: | - mix local.rebar --force + mix local.rebar --force mix local.hex --force mix deps.get - - name: Compile Phoenix Assets working-directory: ${{env.working-directory}} shell: bash @@ -249,52 +299,66 @@ jobs: make esbuild # Download the NIF in the path that Docker expects for x86 - - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v3 + # with: + # path: ./host_core/priv/built/x86_64 + # name: x86_64-unknown-linux-gnu + # # Download the NIF in the path that Docker expects for aarch64 + # - uses: actions/download-artifact@v3 + # with: + # path: ./host_core/priv/built/aarch64 + # name: aarch64-unknown-linux-gnu + + - name: Login to AzureCR + uses: azure/docker-login@v1 with: - path: ./host_core/priv/built/x86_64 - name: x86_64-unknown-linux-gnu - # Download the NIF in the path that Docker expects for aarch64 - - uses: actions/download-artifact@v3 + login-server: ${{ secrets.AZURECR_PUSH_URL }} + username: ${{ secrets.AZURECR_PUSH_USER }} + password: ${{ secrets.AZURECR_PUSH_PASSWORD }} + - name: Login to DockerHub + uses: docker/login-action@v2 with: - path: ./host_core/priv/built/aarch64 - name: aarch64-unknown-linux-gnu - + username: ${{ secrets.DOCKERHUB_PUSH_USER }} + password: ${{ secrets.DOCKERHUB_PUSH_PASSWORD }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + id: buildx-builder - name: Build and release docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: - context: . builder: ${{ steps.buildx-builder.outputs.name }} - # TODO REVERT REVERT - push: false - file: ${{env.working-directory}}/Dockerfile + push: true + context: . + file: ${{ env.app-name }}/Dockerfile platforms: linux/amd64,linux/arm64 build-args: | - BUILDER_IMAGE=elixir:1.13.3-slim - RELEASE_IMAGE=debian:bullseye-slim - APP_NAME=wasmcloud_host - APP_VSN=${{ env.wasmcloud_host_version }} + BUILDER_IMAGE=${{ env.builder-image }} + RELEASE_IMAGE=${{ env.release-image }} + APP_NAME=${{ env.app-name }} + APP_VSN=${{ env.app-version }} SECRET_KEY_BASE=${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} + MIX_ENV=release_prod tags: | - wasmcloud.azurecr.io/wasmcloud_host:${{ env.wasmcloud_host_version }} - wasmcloud.azurecr.io/wasmcloud_host:latest - wasmcloud/wasmcloud_host:${{ env.wasmcloud_host_version }} - wasmcloud/wasmcloud_host:latest + wasmcloud.azurecr.io/strictlytesting${{ env.app-name }}:${{ env.app-version }} - - name: Retrieve aarch64 tarball + # docker run --rm --platform linux/arm64/v8 -iv ${PWD}:/aarch64temp wasmcloud/${{ env.app-name }}:${{ env.app-version}} sh -s <\033[0m\n"} /^[a-zA-Z_\-.*]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - build: deps ## Compile host_core mix compile -docker-build: ## Compile host_core docker image - docker build -t host_core:alpine . +build-image: ## Compile host_core docker image + MIX_ENV=prod docker build -t host_core:alpine . deps: ## Fetch mix dependencies mix deps.get @@ -49,32 +32,10 @@ test: build ## Run test suite, launch NATS with docker-compose # Release Targets ## -HOST_CORE_NATIVE_NIF_DIR ?= priv/native -HOST_CORE_NATIVE_NIF_NAME ?= libhostcore_wasmcloud_native.so -RELEASE_NIF_PATH ?= priv/built -MIX_ENV = release_prod -RELEASE_FILE ?= host_core - -# Copies native NIF from directory into the path the release expects -copy-nif: - @mkdir -p $(RELEASE_NIF_PATH) - @cp $(HOST_CORE_NATIVE_NIF_DIR)/$(HOST_CORE_NATIVE_NIF_NAME) $(RELEASE_NIF_PATH)/$(HOST_CORE_NATIVE_NIF_NAME) - -distillery-release-prod: - @export MIX_ENV=$(MIX_ENV) && \ - mix deps.get && \ - mix compile && \ - mix distillery.release --executable --verbose - -## The following targets assemble a distillery release following a strict order -# 1. Copy the Wasmcloud Native NIF from a supplied location so it can be built separately -# 2. Assemble the distillery release without building a NIF -# 3. Assemble the application tarball with all of the above components -# -# This is intended to be used to easily assemble a distillery release with a provided -# NIF, reducing release times. -release-prod: copy-nif distillery-release-prod ## Assemble distillery release with copied native NIF +# HOST_CORE_NATIVE_NIF_DIR ?= priv/native +# HOST_CORE_NATIVE_NIF_NAME ?= libhostcore_wasmcloud_native.so +# RELEASE_NIF_PATH ?= priv/built +# RELEASE_FILE ?= host_core -cleanup-release: ## Remove distillery release specific artifacts - mix clean - rm -r priv/built _build/release_prod +release: deps ## Creates a mix release for host_core + MIX_ENV=prod mix release diff --git a/host_core/README.md b/host_core/README.md index f35f156c..eb561e73 100644 --- a/host_core/README.md +++ b/host_core/README.md @@ -8,8 +8,8 @@ The use of the [Makefile](./Makefile) is preferred for building and running this ## Prerequisites -- [Elixir installation](https://elixir-lang.org/install.html), minimum `v1.12.0` -- [Erlang/OTP installation](https://elixir-lang.org/install.html#installing-erlang), minimum `OTP 22` +- [Elixir installation](https://elixir-lang.org/install.html), minimum `v1.13.4` +- [Erlang/OTP installation](https://elixir-lang.org/install.html#installing-erlang), minimum `OTP 25` - [NATS installation](https://docs.nats.io/nats-server/installation), minimum `v2.7.2` ## Installation and Running diff --git a/host_core/mix.exs b/host_core/mix.exs index e66efd01..c1038dce 100644 --- a/host_core/mix.exs +++ b/host_core/mix.exs @@ -1,7 +1,7 @@ defmodule HostCore.MixProject do use Mix.Project - @app_vsn "0.56.0" + @app_vsn "0.57.0" def project do [ @@ -15,6 +15,9 @@ defmodule HostCore.MixProject do mode: if(Mix.env() == :dev, do: :debug, else: :release) ] ], + releases: [ + host_core: [] + ], dialyzer: [plt_add_deps: :apps_direct] ] end @@ -61,8 +64,7 @@ defmodule HostCore.MixProject do {:httpoison, "~> 1.8", only: [:test]}, {:json, "~> 1.4", only: [:test]}, {:benchee, "~> 1.0", only: :test}, - {:mock, "~> 0.3.0", only: :test}, - {:distillery, "~> 2.1"} + {:mock, "~> 0.3.0", only: :test} ] end end diff --git a/host_core/mix.lock b/host_core/mix.lock index 87b7f98d..4bd9fa76 100644 --- a/host_core/mix.lock +++ b/host_core/mix.lock @@ -14,7 +14,6 @@ "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, - "distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"}, "ed25519": {:hex, :ed25519, "1.4.1", "479fb83c3e31987c9cad780e6aeb8f2015fb5a482618cdf2a825c9aff809afc4", [:mix], [], "hexpm", "0dacb84f3faa3d8148e81019ca35f9d8dcee13232c32c9db5c2fb8ff48c80ec7"}, "erlavro": {:hex, :erlavro, "2.9.8", "9b9c0eff6dc1c708a277b4143c0020659c42bcd634d0d7237c6435fb0c2f3266", [:make, :rebar3], [{:jsone, "1.4.6", [hex: :jsone, repo: "hexpm", optional: false]}, {:snappyer, "1.2.8", [hex: :snappyer, repo: "hexpm", optional: false]}], "hexpm", "7182c539f408633927b30380aa6123ea3e4b9a04c2bc752f0fe227ef5e9c3a70"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, diff --git a/host_core/native/hostcore_wasmcloud_native/.cargo/config b/host_core/native/hostcore_wasmcloud_native/.cargo/config index bfb607b0..a04abe9f 100644 --- a/host_core/native/hostcore_wasmcloud_native/.cargo/config +++ b/host_core/native/hostcore_wasmcloud_native/.cargo/config @@ -9,3 +9,8 @@ rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ] + +[target.aarch64-unknown-linux-musl] +rustflags = [ + "-C", "target-feature=-crt-static" +] \ No newline at end of file diff --git a/host_core/rel/config.exs b/host_core/rel/config.exs index b853717d..c5e2264d 100644 --- a/host_core/rel/config.exs +++ b/host_core/rel/config.exs @@ -7,15 +7,6 @@ |> Path.wildcard() |> Enum.map(&Code.eval_file(&1)) -use Distillery.Releases.Config, - # This sets the default release built by `mix distillery.release` - default_release: :default, - # This sets the default environment used by `mix distillery.release` - default_environment: :prod - -# For a full list of config options for both releases -# and environments, visit https://hexdocs.pm/distillery/config/distillery.html - # You may define one or more environments in this file, # an environment's settings will override those of a release # when building in that environment, this combination of release @@ -39,18 +30,3 @@ environment :prod do set(cookie: :"@{c_aB(}`DdY[Jio}f9yF~!j_b$~>`Iy;=oY&TV{P{d2i|Zz~7DIB5Hj%yq[C]E^") set(vm_args: "rel/vm.args") end - -# You may define one or more releases in this file. -# If you have not set a default release, or selected one -# when running `mix distillery.release`, the first release in the file -# will be used by default - -release :host_core do - set(version: current_version(:host_core)) - - set( - applications: [ - :runtime_tools - ] - ) -end diff --git a/wasmcloud_host/Dockerfile b/wasmcloud_host/Dockerfile index 90a35bac..a7afd834 100644 --- a/wasmcloud_host/Dockerfile +++ b/wasmcloud_host/Dockerfile @@ -1,18 +1,16 @@ -#Goal: use docker to build container, pull tarball out of container # NOTE: This docker image must be built from the root of this repository in order to copy `host_core`. # Use the Makefile target `build-image` for best results. ARG BUILDER_IMAGE ARG RELEASE_IMAGE +ARG MIX_ENV=prod +ARG SECRET_KEY_BASE ## # STEP 1: Retrieve dependencies (must happen before NIF compilation) ## FROM ${BUILDER_IMAGE} AS deps-builder -ARG MIX_ENV=release_prod -ARG SECRET_KEY_BASE - ENV MIX_ENV=${MIX_ENV} \ SECRET_KEY_BASE=${SECRET_KEY_BASE} @@ -21,6 +19,9 @@ WORKDIR /opt/app COPY ./host_core ./host_core COPY ./wasmcloud_host ./wasmcloud_host +RUN cat /etc/os-release +RUN uname -a + # Install necessary system dependencies RUN apt update && \ DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ @@ -83,21 +84,19 @@ RUN apt update && \ RUN mix local.rebar --force && \ mix local.hex --force -COPY ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so ./host_core/priv/built/x86_64/libhostcore_wasmcloud_native.so -COPY ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so ./host_core/priv/built/aarch64/libhostcore_wasmcloud_native.so -# Grab platform-specific NIF -RUN cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so -RUN rm -rf ./host_core/priv/built/x86_64 ./host_core/priv/built/aarch64 ./host_core/priv/native +# Grab platform-specific NIF if building with release_prod, otherwise install rust for building the NIF manually +RUN if [ "$MIX_ENV" = "release_prod"] ; then cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so ; else curl https://sh.rustup.rs -sSf | bash -s -- -y ; fi +# Ensure intermediate artifacts don't get bundled into the final release +RUN rm -rf host_core/priv/built/aarch64 host_core/priv/built/x86_64 host_core/priv/native +# Set PATH to include Rust toolchain +ENV PATH="/root/.cargo/bin:${PATH}" + WORKDIR ./wasmcloud_host RUN mix do deps.compile, compile RUN mkdir -p /opt/built && \ - mix distillery.release --verbose && \ - cp _build/${MIX_ENV}/rel/${APP_NAME}/releases/${APP_VSN}/${APP_NAME}.tar.gz /opt/built && \ - cd /opt/built && \ - tar -xzf ${APP_NAME}.tar.gz && \ - mkdir -p /opt/rel && \ - mv ${APP_NAME}.tar.gz /opt/rel + mix release && \ + cp -r _build/${MIX_ENV}/rel/${APP_NAME}/* /opt/built ## # STEP 3: Build optimized final release image @@ -140,4 +139,4 @@ ENV WASMCLOUD_RPC_HOST=${WASMCLOUD_RPC_HOST} \ WASMCLOUD_CTL_HOST=${WASMCLOUD_CTL_HOST} \ WASMCLOUD_PROV_RPC_HOST=${WASMCLOUD_PROV_RPC_HOST} -CMD ["/opt/app/bin/wasmcloud_host", "foreground"] +CMD ["/opt/app/bin/wasmcloud_host", "start"] diff --git a/wasmcloud_host/Makefile b/wasmcloud_host/Makefile index 794cf605..94fe6950 100644 --- a/wasmcloud_host/Makefile +++ b/wasmcloud_host/Makefile @@ -20,17 +20,18 @@ help: ## Display this help build-image: build esbuild ## Build docker image for running, testing, or distribution cd ../ && \ docker build $(BASE_ARGS) \ - --build-arg BUILDER_IMAGE=elixir:1.13.3-slim \ + --build-arg BUILDER_IMAGE=elixir:1.13.4-otp-25-slim \ --build-arg RELEASE_IMAGE=debian:bullseye-slim \ $(BASE_TAGS) \ -f $(DOCKERFILE) \ . -build-arm-image: build esbuild ## Build arm64 docker image for running, testing, or distribution +build-arm-image: #build esbuild ## Build arm64 docker image for running, testing, or distribution cd ../ && \ docker buildx build $(BASE_ARGS) \ - --build-arg BUILDER_IMAGE=elixir:1.13.3-slim \ + --build-arg BUILDER_IMAGE=elixir:1.13.4-otp-25-slim \ --build-arg RELEASE_IMAGE=debian:bullseye-slim \ + --build-arg MIX_ENV=prod \ -t wasmcloud_host:arm64 \ --platform linux/arm64 \ --load \ @@ -40,11 +41,7 @@ build-arm-image: build esbuild ## Build arm64 docker image for running, testing, deps: ## Fetch mix dependencies mix deps.get -release-prod: build - cd ../host_core && copy-nif - MIX_ENV=release_prod SECRET_KEY_BASE=$(SECRET_KEY_BASE) mix distillery.release --verbose - -esbuild: +esbuild: deps mix sass default assets/css/app.scss priv/static/assets/app.css mix assets.deploy cp -r assets/static/* priv/static/ diff --git a/wasmcloud_host/chart/Chart.yaml b/wasmcloud_host/chart/Chart.yaml index 5806d0b7..eeece73c 100644 --- a/wasmcloud_host/chart/Chart.yaml +++ b/wasmcloud_host/chart/Chart.yaml @@ -15,6 +15,6 @@ icon: https://github.com/wasmCloud/wasmcloud.com-dev/raw/main/static/images/wasm type: application -version: 0.6.2 +version: 0.6.3 -appVersion: "0.56.0" +appVersion: "0.57.0" diff --git a/wasmcloud_host/mix.exs b/wasmcloud_host/mix.exs index 0ad77ccd..aaeabb0e 100644 --- a/wasmcloud_host/mix.exs +++ b/wasmcloud_host/mix.exs @@ -1,7 +1,7 @@ defmodule WasmcloudHost.MixProject do use Mix.Project - @app_vsn "0.56.0" + @app_vsn "0.57.0" def project do [ @@ -12,6 +12,9 @@ defmodule WasmcloudHost.MixProject do compilers: [:phoenix] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), + releases: [ + wasmcloud_host: [] + ], deps: deps() ] end @@ -49,7 +52,6 @@ defmodule WasmcloudHost.MixProject do {:jason, "~> 1.0"}, {:plug_cowboy, "~> 2.0"}, {:host_core, path: "../host_core"}, - {:distillery, "~> 2.1"}, {:file_system, "~> 0.2"}, {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, {:credo, "~> 1.6", only: [:dev, :test], runtime: false} diff --git a/wasmcloud_host/mix.lock b/wasmcloud_host/mix.lock index 349bf7e9..42c871b9 100644 --- a/wasmcloud_host/mix.lock +++ b/wasmcloud_host/mix.lock @@ -6,7 +6,7 @@ "castore": {:hex, :castore, "0.1.17", "ba672681de4e51ed8ec1f74ed624d104c0db72742ea1a5e74edbc770c815182f", [:mix], [], "hexpm", "d9844227ed52d26e7519224525cb6868650c272d4a3d327ce3ca5570c12163f9"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "chatterbox": {:hex, :ts_chatterbox, "0.11.0", "b8f372c706023eb0de5bf2976764edb27c70fe67052c88c1f6a66b3a5626847f", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "722fe2bad52913ab7e87d849fc6370375f0c961ffb2f0b5e6d647c9170c382a6"}, - "cloudevents": {:hex, :cloudevents, "0.4.0", "bf8b38fe530f0507db4e056818c8742fa96daa06367681cb126a782fb4526ba5", [:mix], [{:avrora, "~> 0.11", [hex: :avrora, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.2.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "9a971243124c43302b8a996143cc3f391353abe5a83485c81c92986385d27455"}, + "cloudevents": {:hex, :cloudevents, "0.6.1", "d3f467a615c00712cf3c9632f6d131695fd3e1d29c10477d2d2fbbec06350522", [:mix], [{:avrora, "~> 0.21", [hex: :avrora, repo: "hexpm", optional: true]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "f0055549bc651bd6702347328dd5824d3f08fbf308d2c7212252e34e345bcb9c"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"}, @@ -15,7 +15,6 @@ "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, "dart_sass": {:hex, :dart_sass, "0.5.0", "c52ad951d9bf611399b6d5efbf404f58dc3a699753662081fbcd4752c6ddeed0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "bb76938174af8e047e855d3bb83e84ceca17e9acbf1ac6429f9d18171da4a911"}, "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, - "distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"}, "ed25519": {:hex, :ed25519, "1.4.0", "3eee373a77c8230ac25ab1d557f436eb6ec584946d7b76ca311f9fa18db84b55", [:mix], [], "hexpm", "420b52c68e2eda14a822c1d15df6c3e386f7b604d4351d6621a2f6baa68ed6dd"}, "erlavro": {:hex, :erlavro, "2.9.7", "4880ed3d92bb07c89d20db13bc51300bcaa691a602ae2bd2859c6e760e322b38", [:make, :rebar, :rebar3], [{:jsone, "1.4.6", [hex: :jsone, repo: "hexpm", optional: false]}, {:snappyer, "1.2.8", [hex: :snappyer, repo: "hexpm", optional: false]}], "hexpm", "4d2a16892b640bd45e1cffb65d472328b1badf252ea061cbbb73df560ddc5941"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, @@ -67,7 +66,7 @@ "timex": {:hex, :timex, "3.7.8", "0e6e8bf7c0aba95f1e13204889b2446e7a5297b1c8e408f15ab58b2c8dc85f81", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8f3b8edc5faab5205d69e5255a1d64a83b190bab7f16baa78aefcb897cf81435"}, "tls_certificate_check": {:hex, :tls_certificate_check, "1.14.0", "6d1638d56ac68b25c987d401dffb7cd059281339aadc3f8bf27ab33ee19ddbfe", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "b4452ddd3ae89cd84451afa0e218cb3ccd5178fe3c1de7fabcbddb12a137bcf4"}, "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, - "typed_struct": {:hex, :typed_struct, "0.2.1", "e1993414c371f09ff25231393b6430bd89d780e2a499ae3b2d2b00852f593d97", [:mix], [], "hexpm", "8f5218c35ec38262f627b2c522542f1eae41f625f92649c0af701a6fab2e11b3"}, + "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"}, From 58d15adc2cf77069715fd07c28a2df255ca37425 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Wed, 24 Aug 2022 10:24:51 -0400 Subject: [PATCH 4/8] no otp-25 image Signed-off-by: Brooks Townsend full CI test Signed-off-by: Brooks Townsend --- .github/workflows/host_core.yml | 178 +++++++------- .github/workflows/release.yml | 347 +++++++++++++-------------- .github/workflows/wasmcloud_host.yml | 170 ++++++------- 3 files changed, 343 insertions(+), 352 deletions(-) diff --git a/.github/workflows/host_core.yml b/.github/workflows/host_core.yml index 4c0133e8..422eaf18 100644 --- a/.github/workflows/host_core.yml +++ b/.github/workflows/host_core.yml @@ -1,101 +1,101 @@ -# name: HostCore Elixir CI +name: HostCore Elixir CI -# on: -# push: -# branches: [main] -# pull_request: -# branches: [main] +on: + push: + branches: [main] + pull_request: + branches: [main] -# env: -# MIX_ENV: test -# working-directory: host_core +env: + MIX_ENV: test + working-directory: host_core -# jobs: -# build: -# strategy: -# fail-fast: false -# matrix: -# os: [ubuntu-20.04, windows-2019, macos-10.15] -# elixir: [1.13.4] -# otp: [25] +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019, macos-10.15] + elixir: [1.13.4] + otp: [24, 25] -# name: Build and test -# runs-on: ${{ matrix.os }} + name: Build and test + runs-on: ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 -# # Install erlang/OTP and elixir -# - name: Install erlang and elixir -# if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} -# uses: erlef/setup-beam@v1 -# with: -# otp-version: "=${{ matrix.otp }}" -# elixir-version: ${{ matrix.elixir }} -# install-hex: true -# install-rebar: true -# - name: Install erlang and elixir -# if: ${{ startswith(matrix.os, 'macos') }} -# run: | -# brew install erlang -# brew install elixir + # Install erlang/OTP and elixir + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} + uses: erlef/setup-beam@v1 + with: + otp-version: "=${{ matrix.otp }}" + elixir-version: ${{ matrix.elixir }} + install-hex: true + install-rebar: true + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'macos') }} + run: | + brew install erlang + brew install elixir -# # If dependencies aren't changing, retrieve cache -# - name: Retrieve Mix Dependencies Cache -# uses: actions/cache@v2 -# id: mix-cache #id to use in retrieve action -# with: -# path: | -# host_core/deps -# host_core/_build -# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} + # If dependencies aren't changing, retrieve cache + - name: Retrieve Mix Dependencies Cache + uses: actions/cache@v2 + id: mix-cache #id to use in retrieve action + with: + path: | + host_core/deps + host_core/_build + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} -# - name: Install Rebar and Hex -# working-directory: ${{env.working-directory}} -# run: | -# mix local.rebar --force -# mix local.hex --force -# - name: Install Mix Dependencies -# working-directory: ${{env.working-directory}} -# if: steps.mix-cache.outputs.cache-hit != 'true' -# run: | -# mix do deps.get, deps.compile + - name: Install Rebar and Hex + working-directory: ${{env.working-directory}} + run: | + mix local.rebar --force + mix local.hex --force + - name: Install Mix Dependencies + working-directory: ${{env.working-directory}} + if: steps.mix-cache.outputs.cache-hit != 'true' + run: | + mix do deps.get, deps.compile -# - name: Check Formatting -# if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns -# working-directory: ${{env.working-directory}} -# run: mix format --check-formatted + - name: Check Formatting + if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns + working-directory: ${{env.working-directory}} + run: mix format --check-formatted -# - name: Run Credo -# working-directory: ${{env.working-directory}} -# continue-on-error: true # Don't fail entire action with refactoring opportunities for now -# run: mix credo --strict + - name: Run Credo + working-directory: ${{env.working-directory}} + continue-on-error: true # Don't fail entire action with refactoring opportunities for now + run: mix credo --strict -# - name: Run Tests -# if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners -# working-directory: ${{env.working-directory}} -# env: -# EXTRA_TEST_ARGS: "--timeout 120000" -# WASMCLOUD_RPC_TIMEOUT_MS: 3000 -# MIX_ENV: test -# run: | -# WASMCLOUD_LATTICE_PREFIX=$(echo "${{ runner.os }}__${{ matrix.otp }}__${{ matrix.elixir }}__${{ env.working-directory }}" | sed 's/\./_/g') \ -# make test + - name: Run Tests + if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners + working-directory: ${{env.working-directory}} + env: + EXTRA_TEST_ARGS: "--timeout 120000" + WASMCLOUD_RPC_TIMEOUT_MS: 3000 + MIX_ENV: test + run: | + WASMCLOUD_LATTICE_PREFIX=$(echo "${{ runner.os }}__${{ matrix.otp }}__${{ matrix.elixir }}__${{ env.working-directory }}" | sed 's/\./_/g') \ + make test -# - name: Retrieve PLT Cache -# uses: actions/cache@v2 -# id: plt-cache -# with: -# path: host_core/priv/plts -# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} -# - name: Create PLTs -# working-directory: ${{env.working-directory}} -# if: steps.plt-cache.outputs.cache-hit != 'true' -# run: | -# mkdir -p priv/plts -# mix dialyzer --plt -# - name: Run dialyzer -# working-directory: ${{env.working-directory}} -# continue-on-error: true # Don't fail entire action with dialyzer opportunities for now -# run: mix dialyzer --no-check -# # Thank you https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions for this action setup + - name: Retrieve PLT Cache + uses: actions/cache@v2 + id: plt-cache + with: + path: host_core/priv/plts + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }} + - name: Create PLTs + working-directory: ${{env.working-directory}} + if: steps.plt-cache.outputs.cache-hit != 'true' + run: | + mkdir -p priv/plts + mix dialyzer --plt + - name: Run dialyzer + working-directory: ${{env.working-directory}} + continue-on-error: true # Don't fail entire action with dialyzer opportunities for now + run: mix dialyzer --no-check +# Thank you https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions for this action setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae7d4618..15d9182c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,178 +10,169 @@ env: otp-version: 25 elixir-version: 1.13.4 -# Steps: -# 1. Compile the NIF in parallel -# 2a. Build mix release, copying NIF into the correct location -# 2b. Build docker image, copying NIF into the container -# 3. Create GH release with artifacts jobs: - # compile-native-nif: - # #TODO: revert revert - # # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - # # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - # name: Compile NIFs - # env: - # working-directory: ./host_core/native/hostcore_wasmcloud_native - # artifact-name: hostcore_wasmcloud_native - # strategy: - # matrix: - # target: - # - x86_64-unknown-linux-gnu - # - aarch64-unknown-linux-gnu - # - aarch64-unknown-linux-musl - # - x86_64-apple-darwin - # - x86_64-pc-windows-gnu - # runs-on: ubuntu-20.04 - # steps: - # - uses: actions/checkout@v3 + compile-native-nif: + # Run on tag push or on manual dispatch. Release will not be created for manual dispatch + # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + name: Compile NIFs + env: + working-directory: ./host_core/native/hostcore_wasmcloud_native + artifact-name: hostcore_wasmcloud_native + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + - x86_64-apple-darwin + - x86_64-pc-windows-gnu + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 - # - name: Build native nif - # run: | - # wget https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-gnu.tar.gz - # tar -xf cross-x86_64-unknown-linux-gnu.tar.gz - # chmod +x cross - # ./cross build --release --target ${{ matrix.target }} - # working-directory: ${{ env.working-directory }} + - name: Build native nif + run: | + wget https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-gnu.tar.gz + tar -xf cross-x86_64-unknown-linux-gnu.tar.gz + chmod +x cross + ./cross build --release --target ${{ matrix.target }} + working-directory: ${{ env.working-directory }} - # - name: Upload nif to GH Actions - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ matrix.target }} - # if-no-files-found: error - # path: | - # ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.so - # ${{ env.working-directory }}/target/${{ matrix.target }}/release/${{ env.artifact-name }}.dll - # ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.dylib + - name: Upload nif to GH Actions + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target }} + if-no-files-found: error + path: | + ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.so + ${{ env.working-directory }}/target/${{ matrix.target }}/release/${{ env.artifact-name }}.dll + ${{ env.working-directory }}/target/${{ matrix.target }}/release/lib${{ env.artifact-name }}.dylib - # create-mix-releases: - # # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - # # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - # needs: compile-native-nif - # name: Mix release - # strategy: - # fail-fast: false - # matrix: - # os: [ubuntu-20.04, windows-2019, macos-11] - # working-directory: [wasmcloud_host, host_core] - # include: - # - os: ubuntu-20.04 - # rust-target: x86_64-unknown-linux-gnu - # release-tarball: x86_64-linux.tar.gz - # working-directory: wasmcloud_host - # - os: windows-2019 - # rust-target: x86_64-pc-windows-gnu - # release-tarball: x86_64-windows.tar.gz - # working-directory: wasmcloud_host - # - os: macos-11 - # rust-target: x86_64-apple-darwin - # release-tarball: x86_64-macos.tar.gz - # working-directory: wasmcloud_host - # - os: ubuntu-20.04 - # rust-target: x86_64-unknown-linux-gnu - # release-tarball: x86_64-linux-core.tar.gz - # working-directory: host_core - # - os: windows-2019 - # rust-target: x86_64-pc-windows-gnu - # release-tarball: x86_64-windows-core.tar.gz - # working-directory: host_core - # - os: macos-11 - # rust-target: x86_64-apple-darwin - # release-tarball: x86_64-macos-core.tar.gz - # working-directory: host_core - # runs-on: ${{ matrix.os }} - # env: - # working-directory: ${{ matrix.working-directory }} - # MIX_ENV: release_prod - # SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} + create-mix-releases: + # Run on tag push or on manual dispatch. Release will not be created for manual dispatch + # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + needs: compile-native-nif + name: Mix release + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019, macos-11] + working-directory: [wasmcloud_host, host_core] + include: + - os: ubuntu-20.04 + rust-target: x86_64-unknown-linux-gnu + release-tarball: x86_64-linux.tar.gz + working-directory: wasmcloud_host + - os: windows-2019 + rust-target: x86_64-pc-windows-gnu + release-tarball: x86_64-windows.tar.gz + working-directory: wasmcloud_host + - os: macos-11 + rust-target: x86_64-apple-darwin + release-tarball: x86_64-macos.tar.gz + working-directory: wasmcloud_host + - os: ubuntu-20.04 + rust-target: x86_64-unknown-linux-gnu + release-tarball: x86_64-linux-core.tar.gz + working-directory: host_core + - os: windows-2019 + rust-target: x86_64-pc-windows-gnu + release-tarball: x86_64-windows-core.tar.gz + working-directory: host_core + - os: macos-11 + rust-target: x86_64-apple-darwin + release-tarball: x86_64-macos-core.tar.gz + working-directory: host_core + runs-on: ${{ matrix.os }} + env: + working-directory: ${{ matrix.working-directory }} + MIX_ENV: release_prod + SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} - # steps: - # - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 - # # Install erlang/OTP and elixir - # - name: Install erlang and elixir - # if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} - # uses: erlef/setup-beam@v1 - # with: - # otp-version: "=${{ env.otp-version }}" - # elixir-version: "${{ env.elixir-version }}" - # install-hex: true - # install-rebar: true - # - name: Install erlang and elixir - # if: ${{ startswith(matrix.os, 'macos') }} - # run: | - # brew install erlang - # brew install elixir + # Install erlang/OTP and elixir + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} + uses: erlef/setup-beam@v1 + with: + otp-version: "=${{ env.otp-version }}" + elixir-version: "${{ env.elixir-version }}" + install-hex: true + install-rebar: true + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'macos') }} + run: | + brew install erlang + brew install elixir - # - name: Retrieve Mix Dependencies Cache - # if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache - # uses: actions/cache@v2 - # id: mix-cache #id to use in retrieve action - # with: - # path: | - # ${{ env.working-directory }}/deps - # key: ${{ runner.os }}-${{ env.ERLANG_VERSION }}-${{ env.ELIXIR_VERSION }}-mix-${{ hashFiles('${{ env.working-directory }}/mix.exs', '${{ env.working-directory }}/mix.lock') }} + - name: Retrieve Mix Dependencies Cache + if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache + uses: actions/cache@v2 + id: mix-cache #id to use in retrieve action + with: + path: | + ${{ env.working-directory }}/deps + key: ${{ runner.os }}-${{ env.ERLANG_VERSION }}-${{ env.ELIXIR_VERSION }}-mix-${{ hashFiles('${{ env.working-directory }}/mix.exs', '${{ env.working-directory }}/mix.lock') }} - # - name: Install Mix Dependencies - # working-directory: ${{env.working-directory}} - # shell: bash - # run: | - # mix local.rebar --force - # mix local.hex --force - # mix deps.get + - name: Install Mix Dependencies + working-directory: ${{env.working-directory}} + shell: bash + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get - # # Download the NIF in the path that Rustler expects - # - uses: actions/download-artifact@v3 - # with: - # path: ./host_core/priv/built - # name: ${{ matrix.rust-target }} - # # Rustler looks for .so, even on Mac - # - name: Rename NIF to shared object - # if: ${{ startswith(matrix.os, 'macos') }} - # working-directory: ./host_core/priv/built - # run: | - # mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.so - # # Rustler looks for .dll on Windows - # - name: Rename NIF to shared object - # if: ${{ startswith(matrix.os, 'windows') }} - # working-directory: ./host_core/priv/built - # run: | - # mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.dll + # Download the NIF in the path that Rustler expects + - uses: actions/download-artifact@v3 + with: + path: ./host_core/priv/built + name: ${{ matrix.rust-target }} + # Rustler looks for .so, even on Mac + - name: Rename NIF to shared object + if: ${{ startswith(matrix.os, 'macos') }} + working-directory: ./host_core/priv/built + run: | + mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.so + # Rustler looks for .dll on Windows + - name: Rename NIF to shared object + if: ${{ startswith(matrix.os, 'windows') }} + working-directory: ./host_core/priv/built + run: | + mv *hostcore_wasmcloud_native* libhostcore_wasmcloud_native.dll - # - name: Compile Elixir - # working-directory: ${{env.working-directory}} - # shell: bash - # run: | - # mix compile + - name: Compile Elixir + working-directory: ${{env.working-directory}} + shell: bash + run: | + mix compile - # - name: Compile Phoenix Assets - # if: ${{ env.working-directory == 'wasmcloud_host' }} - # working-directory: ${{env.working-directory}} - # shell: bash - # run: | - # make esbuild + - name: Compile Phoenix Assets + if: ${{ env.working-directory == 'wasmcloud_host' }} + working-directory: ${{env.working-directory}} + shell: bash + run: | + make esbuild - # - name: Create Mix Release - # working-directory: ${{env.working-directory}} - # shell: bash - # run: | - # mix release - # cd _build/${{ env.MIX_ENV }}/rel/${{env.working-directory}} - # ls -lah - # tar -czvf ${{ matrix.release-tarball }} bin erts-* lib releases - # ls -lah - # mv ${{ matrix.release-tarball }} ../../../../ + - name: Create Mix Release + working-directory: ${{env.working-directory}} + shell: bash + run: | + mix release + cd _build/${{ env.MIX_ENV }}/rel/${{env.working-directory}} + tar -czvf ${{ matrix.release-tarball }} bin erts-* lib releases + mv ${{ matrix.release-tarball }} ../../../../ - # - name: Upload artifact - # uses: actions/upload-artifact@v2 - # with: - # name: ${{ matrix.release-tarball }} - # path: ${{env.working-directory}}/${{ matrix.release-tarball }} + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.release-tarball }} + path: ${{env.working-directory}}/${{ matrix.release-tarball }} release-hostcore-docker: - #TODO: revert revert # if: startswith(github.ref, 'refs/tags/') # Only run on tag push - # needs: compile-native-nif + needs: compile-native-nif name: Release Image (host_core) runs-on: ubuntu-22.04 env: @@ -190,7 +181,7 @@ jobs: SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }} app-name: host_core arm-tarball: aarch64-linux-musl-core.tar.gz - builder-image: elixir:1.13.4-otp-25-alpine + builder-image: elixir:1.13.4-alpine release-image: alpine:3.16 steps: - uses: actions/checkout@v3 @@ -198,15 +189,15 @@ jobs: run: echo "app-version=$(grep '@app_vsn "' ${{env.working-directory}}/mix.exs | cut -d '"' -f2)" > $GITHUB_ENV # Download the NIF in the path that Docker expects for x86 - # - uses: actions/download-artifact@v3 - # with: - # path: ./host_core/priv/built/x86_64 - # name: x86_64-unknown-linux-gnu - # # Download the NIF in the path that Docker expects for aarch64 - # - uses: actions/download-artifact@v3 - # with: - # path: ./host_core/priv/built/aarch64 - # name: aarch64-unknown-linux-gnu + - uses: actions/download-artifact@v3 + with: + path: ./host_core/priv/built/x86_64 + name: x86_64-unknown-linux-gnu + # Download the NIF in the path that Docker expects for aarch64 + - uses: actions/download-artifact@v3 + with: + path: ./host_core/priv/built/aarch64 + name: aarch64-unknown-linux-gnu - name: Login to AzureCR uses: azure/docker-login@v1 @@ -261,9 +252,8 @@ jobs: # # So, sorry about the code duplication, perhaps in the future we'll find a way to make this happen release-wasmcloud-docker: - #TODO: revert revert # if: startswith(github.ref, 'refs/tags/') # Only run on tag push - # needs: compile-native-nif + needs: compile-native-nif name: Release Image (wasmcloud_host) runs-on: ubuntu-22.04 env: @@ -299,15 +289,15 @@ jobs: make esbuild # Download the NIF in the path that Docker expects for x86 - # - uses: actions/download-artifact@v3 - # with: - # path: ./host_core/priv/built/x86_64 - # name: x86_64-unknown-linux-gnu - # # Download the NIF in the path that Docker expects for aarch64 - # - uses: actions/download-artifact@v3 - # with: - # path: ./host_core/priv/built/aarch64 - # name: aarch64-unknown-linux-gnu + - uses: actions/download-artifact@v3 + with: + path: ./host_core/priv/built/x86_64 + name: x86_64-unknown-linux-gnu + # Download the NIF in the path that Docker expects for aarch64 + - uses: actions/download-artifact@v3 + with: + path: ./host_core/priv/built/aarch64 + name: aarch64-unknown-linux-gnu - name: Login to AzureCR uses: azure/docker-login@v1 @@ -358,7 +348,8 @@ jobs: github-release: if: startswith(github.ref, 'refs/tags/') # Only run on tag push - # needs: [create-mix-releases, release-hostcore-docker, release-wasmcloud-docker] + needs: + [create-mix-releases, release-hostcore-docker, release-wasmcloud-docker] runs-on: ubuntu-latest steps: - name: Download Release Tarballs diff --git a/.github/workflows/wasmcloud_host.yml b/.github/workflows/wasmcloud_host.yml index 0898eb42..81263c09 100644 --- a/.github/workflows/wasmcloud_host.yml +++ b/.github/workflows/wasmcloud_host.yml @@ -1,97 +1,97 @@ -# name: WasmcloudHost Elixir CI +name: WasmcloudHost Elixir CI -# on: -# push: -# branches: [main] -# pull_request: -# branches: [main] +on: + push: + branches: [main] + pull_request: + branches: [main] -# env: -# working-directory: wasmcloud_host +env: + working-directory: wasmcloud_host -# jobs: -# build: -# strategy: -# fail-fast: false -# matrix: -# os: [ubuntu-20.04, windows-2019, macos-10.15] -# elixir: [1.13.4] -# otp: [25] +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019, macos-10.15] + elixir: [1.13.4] + otp: [24, 25] -# name: Build and test -# runs-on: ${{ matrix.os }} -# env: -# MIX_ENV: test + name: Build and test + runs-on: ${{ matrix.os }} + env: + MIX_ENV: test -# steps: -# - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 -# # Install erlang/OTP and elixir -# - name: Install erlang and elixir -# if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} -# uses: erlef/setup-beam@v1 -# with: -# otp-version: "=${{ matrix.otp }}" -# elixir-version: ${{ matrix.elixir }} -# install-hex: true -# install-rebar: true -# - name: Install erlang and elixir -# if: ${{ startswith(matrix.os, 'macos') }} -# run: | -# brew install erlang -# brew install elixir + # Install erlang/OTP and elixir + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }} + uses: erlef/setup-beam@v1 + with: + otp-version: "=${{ matrix.otp }}" + elixir-version: ${{ matrix.elixir }} + install-hex: true + install-rebar: true + - name: Install erlang and elixir + if: ${{ startswith(matrix.os, 'macos') }} + run: | + brew install erlang + brew install elixir -# - name: Retrieve Mix Dependencies Cache -# if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache -# uses: actions/cache@v2 -# id: mix-cache #id to use in retrieve action -# with: -# path: | -# wasmcloud_host/deps -# wasmcloud_host/_build -# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('wasmcloud_host/mix.exs', 'wasmcloud_host/mix.lock') }} + - name: Retrieve Mix Dependencies Cache + if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about not owning files if you restore from cache + uses: actions/cache@v2 + id: mix-cache #id to use in retrieve action + with: + path: | + wasmcloud_host/deps + wasmcloud_host/_build + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('wasmcloud_host/mix.exs', 'wasmcloud_host/mix.lock') }} -# - name: Install Rebar and Hex -# working-directory: ${{env.working-directory}} -# run: | -# mix local.rebar --force -# mix local.hex --force + - name: Install Rebar and Hex + working-directory: ${{env.working-directory}} + run: | + mix local.rebar --force + mix local.hex --force -# - name: Install Mix Dependencies -# working-directory: ${{env.working-directory}} -# if: steps.mix-cache.outputs.cache-hit != 'true' -# run: | -# mix do deps.get, deps.compile + - name: Install Mix Dependencies + working-directory: ${{env.working-directory}} + if: steps.mix-cache.outputs.cache-hit != 'true' + run: | + mix do deps.get, deps.compile -# - name: Check Formatting -# if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns -# working-directory: ${{env.working-directory}} -# run: mix format --check-formatted + - name: Check Formatting + if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns + working-directory: ${{env.working-directory}} + run: mix format --check-formatted -# - name: Ensure static files build properly -# working-directory: ${{env.working-directory}} -# shell: bash -# env: -# MIX_ENV: dev -# run: make esbuild + - name: Ensure static files build properly + working-directory: ${{env.working-directory}} + shell: bash + env: + MIX_ENV: dev + run: make esbuild -# - name: Run Credo -# working-directory: ${{env.working-directory}} -# continue-on-error: true # Don't fail entire action with refactoring opportunities for now -# run: mix credo --strict -# - name: Retrieve PLT Cache -# uses: actions/cache@v2 -# id: plt-cache -# with: -# path: wasmcloud_host/priv/plts -# key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('wasmcloud_host/mix.exs', 'wasmcloud_host/mix.lock') }} -# - name: Create PLTs -# working-directory: ${{env.working-directory}} -# if: steps.plt-cache.outputs.cache-hit != 'true' -# run: | -# mkdir -p priv/plts -# mix dialyzer --plt -# - name: Run dialyzer -# working-directory: ${{env.working-directory}} -# continue-on-error: true # Don't fail entire action with dialyzer opportunities for now -# run: mix dialyzer --no-check + - name: Run Credo + working-directory: ${{env.working-directory}} + continue-on-error: true # Don't fail entire action with refactoring opportunities for now + run: mix credo --strict + - name: Retrieve PLT Cache + uses: actions/cache@v2 + id: plt-cache + with: + path: wasmcloud_host/priv/plts + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('wasmcloud_host/mix.exs', 'wasmcloud_host/mix.lock') }} + - name: Create PLTs + working-directory: ${{env.working-directory}} + if: steps.plt-cache.outputs.cache-hit != 'true' + run: | + mkdir -p priv/plts + mix dialyzer --plt + - name: Run dialyzer + working-directory: ${{env.working-directory}} + continue-on-error: true # Don't fail entire action with dialyzer opportunities for now + run: mix dialyzer --no-check From b383a967c9834c98fb04d3e5567adb335fff40f7 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Wed, 24 Aug 2022 11:50:31 -0400 Subject: [PATCH 5/8] cleaning up Makefiles, mix.locks, added OTP 24.3 Signed-off-by: Brooks Townsend corrected if statement for grabbing nifs Signed-off-by: Brooks Townsend 1.13.3 Signed-off-by: Brooks Townsend --- .github/workflows/host_core.yml | 2 +- .github/workflows/wasmcloud_host.yml | 4 +-- host_core/Dockerfile | 2 +- host_core/Makefile | 34 +++++++++++--------- host_core/mix.lock | 5 --- wasmcloud_host/Dockerfile | 2 +- wasmcloud_host/Makefile | 47 +++++++++++++++------------- wasmcloud_host/mix.lock | 31 ++++++++---------- 8 files changed, 62 insertions(+), 65 deletions(-) diff --git a/.github/workflows/host_core.yml b/.github/workflows/host_core.yml index 422eaf18..9e0475cd 100644 --- a/.github/workflows/host_core.yml +++ b/.github/workflows/host_core.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-20.04, windows-2019, macos-10.15] elixir: [1.13.4] - otp: [24, 25] + otp: [24.3, 25] name: Build and test runs-on: ${{ matrix.os }} diff --git a/.github/workflows/wasmcloud_host.yml b/.github/workflows/wasmcloud_host.yml index 81263c09..c21e8d18 100644 --- a/.github/workflows/wasmcloud_host.yml +++ b/.github/workflows/wasmcloud_host.yml @@ -15,8 +15,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-2019, macos-10.15] - elixir: [1.13.4] - otp: [24, 25] + elixir: [1.13.3] + otp: [24.3, 25] name: Build and test runs-on: ${{ matrix.os }} diff --git a/host_core/Dockerfile b/host_core/Dockerfile index fb3ee831..856f8963 100644 --- a/host_core/Dockerfile +++ b/host_core/Dockerfile @@ -16,7 +16,7 @@ COPY ./ ./ RUN apk add bash git curl build-base # Grab platform-specific NIF if building with release_prod, otherwise build NIF manually -RUN if [ "$MIX_ENV" = "release_prod"] ; then cp ./priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./priv/built/libhostcore_wasmcloud_native.so ; else echo "not grabbing" ; fi +RUN if [ "$MIX_ENV" = "release_prod" ] ; then cp ./priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./priv/built/libhostcore_wasmcloud_native.so ; else echo "not grabbing" ; fi # Ensure intermediate artifacts don't get bundled into the final release RUN rm -rf priv/built/aarch64 priv/built/x86_64 priv/native diff --git a/host_core/Makefile b/host_core/Makefile index abbc8f9c..8b11e5f2 100644 --- a/host_core/Makefile +++ b/host_core/Makefile @@ -1,21 +1,34 @@ -.PHONY: build run help deps +.PHONY: build build-image buildx-cross-image run run-interactive test release help deps .DEFAULT: help CARGO ?= cargo --color always - EXTRA_TEST_ARGS ?= help: ## Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\-.*]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) +deps: ## Fetch mix dependencies + mix deps.get + build: deps ## Compile host_core mix compile build-image: ## Compile host_core docker image - MIX_ENV=prod docker build -t host_core:alpine . - -deps: ## Fetch mix dependencies - mix deps.get + docker build \ + --build-arg BUILDER_IMAGE=elixir:1.13.4-alpine \ + --build-arg RELEASE_IMAGE=alpine:3.16 \ + --build-arg MIX_ENV=prod \ + -t host_core:alpine \ + . + +buildx-cross-image: ## Compile host_core docker image using buildx for amd64 and arm64 + docker buildx build \ + --build-arg BUILDER_IMAGE=elixir:1.13.4-alpine \ + --build-arg RELEASE_IMAGE=alpine:3.16 \ + --build-arg MIX_ENV=prod \ + -t host_core:alpine \ + --platform linux/amd64,linux/arm64 \ + . run: build ## Run host_core mix @@ -28,14 +41,5 @@ test: build ## Run test suite, launch NATS with docker-compose MIX_ENV=test mix test $(EXTRA_TEST_ARGS) docker compose -f ./test/docker-compose.yml down -## -# Release Targets -## - -# HOST_CORE_NATIVE_NIF_DIR ?= priv/native -# HOST_CORE_NATIVE_NIF_NAME ?= libhostcore_wasmcloud_native.so -# RELEASE_NIF_PATH ?= priv/built -# RELEASE_FILE ?= host_core - release: deps ## Creates a mix release for host_core MIX_ENV=prod mix release diff --git a/host_core/mix.lock b/host_core/mix.lock index 4bd9fa76..4611a888 100644 --- a/host_core/mix.lock +++ b/host_core/mix.lock @@ -1,7 +1,5 @@ %{ "acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"}, - "artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"}, - "avrora": {:hex, :avrora, "0.24.0", "e1d02fd2116c0a74194230192e7ccfe2d8e53a5eef511e36185188404f7eda9b", [:mix], [{:erlavro, "~> 2.9.3", [hex: :erlavro, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "b2c0e307fbcd0bff3cb37cfa879730d704a2b725d3def29a779dbe7d2cc29011"}, "benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, @@ -15,7 +13,6 @@ "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, "ed25519": {:hex, :ed25519, "1.4.1", "479fb83c3e31987c9cad780e6aeb8f2015fb5a482618cdf2a825c9aff809afc4", [:mix], [], "hexpm", "0dacb84f3faa3d8148e81019ca35f9d8dcee13232c32c9db5c2fb8ff48c80ec7"}, - "erlavro": {:hex, :erlavro, "2.9.8", "9b9c0eff6dc1c708a277b4143c0020659c42bcd634d0d7237c6435fb0c2f3266", [:make, :rebar3], [{:jsone, "1.4.6", [hex: :jsone, repo: "hexpm", optional: false]}, {:snappyer, "1.2.8", [hex: :snappyer, repo: "hexpm", optional: false]}], "hexpm", "7182c539f408633927b30380aa6123ea3e4b9a04c2bc752f0fe227ef5e9c3a70"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, @@ -29,7 +26,6 @@ "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, "json": {:hex, :json, "1.4.1", "8648f04a9439765ad449bc56a3ff7d8b11dd44ff08ffcdefc4329f7c93843dfa", [:mix], [], "hexpm", "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16"}, - "jsone": {:hex, :jsone, "1.4.6", "644d6d57befb22c8e19b324dee19d73b1c004565009861a8f64c68b7b9e64dbf", [:rebar3], [], "hexpm", "78eee8bb38f0bee2e73673d71bc75fc6fb01f56f0d23e769a26eee3655487a38"}, "meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, @@ -46,7 +42,6 @@ "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "rustler": {:hex, :rustler, "0.24.0", "b8362a2fee1c9d2c7373b0bfdc98f75bbc02864efcec50df173fe6c4f72d4cc4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "2773167fca68a6525822ad977b41368ea3c2af876c42ebaa7c9d6bb69b67f1ce"}, "rustler_precompiled": {:hex, :rustler_precompiled, "0.5.1", "93df423bd7b14b67dcacf994443d132d300623f80756974cac4febeab40af74a", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "3f8cbc8e92eef4e1a71bf441b568b868b16a3730f63f5b803c68073017e30b13"}, - "snappyer": {:hex, :snappyer, "1.2.8", "201ce9067a33c71a6a5087c0c3a49a010b17112d461e6df696c722dcb6d0934a", [:rebar3], [], "hexpm", "35518e79a28548b56d8fd6aee2f565f12f51c2d3d053f9cfa817c83be88c4f3d"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, diff --git a/wasmcloud_host/Dockerfile b/wasmcloud_host/Dockerfile index a7afd834..06692c7b 100644 --- a/wasmcloud_host/Dockerfile +++ b/wasmcloud_host/Dockerfile @@ -85,7 +85,7 @@ RUN mix local.rebar --force && \ mix local.hex --force # Grab platform-specific NIF if building with release_prod, otherwise install rust for building the NIF manually -RUN if [ "$MIX_ENV" = "release_prod"] ; then cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so ; else curl https://sh.rustup.rs -sSf | bash -s -- -y ; fi +RUN if [ "$MIX_ENV" = "release_prod" ] ; then cp ./host_core/priv/built/`uname -m`/libhostcore_wasmcloud_native.so ./host_core/priv/built/libhostcore_wasmcloud_native.so ; else curl https://sh.rustup.rs -sSf | bash -s -- -y ; fi # Ensure intermediate artifacts don't get bundled into the final release RUN rm -rf host_core/priv/built/aarch64 host_core/priv/built/x86_64 host_core/priv/native # Set PATH to include Rust toolchain diff --git a/wasmcloud_host/Makefile b/wasmcloud_host/Makefile index 94fe6950..5e4d606a 100644 --- a/wasmcloud_host/Makefile +++ b/wasmcloud_host/Makefile @@ -1,4 +1,4 @@ -.PHONY: help deps +.PHONY: help deps build esbuild release build-image buildx-cross-image run run-interactive NAME ?= `grep 'app:' ./wasmcloud_host/mix.exs | sed -e 's/\[//g' -e 's/ //g' -e 's/app://' -e 's/[:,]//g'` VERSION ?= `grep '@app_vsn ' ./wasmcloud_host/mix.exs | cut -d '"' -f2` @@ -8,48 +8,46 @@ SKIP_PHOENIX ?= false TAG ?= latest SECRET_KEY_BASE ?= $(shell mix phx.gen.secret) -RUST_ARCH ?= x86_64 -RUST_TARGET ?= unknown-linux-gnu - BASE_ARGS ?= --build-arg APP_NAME=$(NAME) --build-arg APP_VSN=$(VERSION) --build-arg SECRET_KEY_BASE=$(SECRET_KEY_BASE) --build-arg SKIP_PHOENIX=$(SKIP_PHOENIX) BASE_TAGS ?= -t $(NAME):$(VERSION)-$(BUILD) -t $(NAME):$(TAG) help: ## Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\-.*]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -build-image: build esbuild ## Build docker image for running, testing, or distribution +deps: ## Fetch mix dependencies + mix deps.get + +build: deps ## Build wasmcloud_host for development + mix compile + +esbuild: deps + mix sass default assets/css/app.scss priv/static/assets/app.css + mix assets.deploy + cp -r assets/static/* priv/static/ + cp -r assets/css/coreui priv/static/assets/coreui + +build-image: build esbuild ## Compile wasmcloud_host docker image, requires local elixir toolchain since dart-sass doesn't work in arm64 environments cd ../ && \ docker build $(BASE_ARGS) \ - --build-arg BUILDER_IMAGE=elixir:1.13.4-otp-25-slim \ + --build-arg BUILDER_IMAGE=elixir:1.13.3-slim \ --build-arg RELEASE_IMAGE=debian:bullseye-slim \ + --build-arg MIX_ENV=prod \ $(BASE_TAGS) \ -f $(DOCKERFILE) \ . -build-arm-image: #build esbuild ## Build arm64 docker image for running, testing, or distribution +buildx-cross-image: build esbuild ## Compile wasmcloud_host docker image using buildx for amd64 and arm64 cd ../ && \ docker buildx build $(BASE_ARGS) \ - --build-arg BUILDER_IMAGE=elixir:1.13.4-otp-25-slim \ + --build-arg BUILDER_IMAGE=elixir:1.13.3-slim \ --build-arg RELEASE_IMAGE=debian:bullseye-slim \ --build-arg MIX_ENV=prod \ - -t wasmcloud_host:arm64 \ - --platform linux/arm64 \ + -t wasmcloud_host:slim \ + --platform linux/amd64,linux/arm64 \ --load \ -f $(DOCKERFILE) \ . -deps: ## Fetch mix dependencies - mix deps.get - -esbuild: deps - mix sass default assets/css/app.scss priv/static/assets/app.css - mix assets.deploy - cp -r assets/static/* priv/static/ - cp -r assets/css/coreui priv/static/assets/coreui - -build: deps ## Build wasmcloud_host for development - mix compile - run: build ## Run development wasmcloud_host mix phx.server @@ -60,3 +58,8 @@ run-image: ## Run the docker compose with specified image tag run-interactive: build ## Run development wasmcloud_host with iex iex -S mix phx.server + + # wasmcloud.azurecr.io/${{ matrix.app-name }}:${{ env.app-version }} + # wasmcloud.azurecr.io/${{ matrix.app-name }}:latest + # wasmcloud/${{ matrix.app-name }}:${{ env.app-version }} + # wasmcloud/${{ matrix.app-name }}:latest \ No newline at end of file diff --git a/wasmcloud_host/mix.lock b/wasmcloud_host/mix.lock index 42c871b9..6a8d8e7c 100644 --- a/wasmcloud_host/mix.lock +++ b/wasmcloud_host/mix.lock @@ -1,39 +1,35 @@ %{ "acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"}, - "artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"}, - "avrora": {:hex, :avrora, "0.24.0", "e1d02fd2116c0a74194230192e7ccfe2d8e53a5eef511e36185188404f7eda9b", [:mix], [{:erlavro, "~> 2.9.3", [hex: :erlavro, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "b2c0e307fbcd0bff3cb37cfa879730d704a2b725d3def29a779dbe7d2cc29011"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, - "castore": {:hex, :castore, "0.1.17", "ba672681de4e51ed8ec1f74ed624d104c0db72742ea1a5e74edbc770c815182f", [:mix], [], "hexpm", "d9844227ed52d26e7519224525cb6868650c272d4a3d327ce3ca5570c12163f9"}, + "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, - "chatterbox": {:hex, :ts_chatterbox, "0.11.0", "b8f372c706023eb0de5bf2976764edb27c70fe67052c88c1f6a66b3a5626847f", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "722fe2bad52913ab7e87d849fc6370375f0c961ffb2f0b5e6d647c9170c382a6"}, + "chatterbox": {:hex, :ts_chatterbox, "0.12.0", "4e54f199e15c0320b85372a24e35554a2ccfc4342e0b7cd8daed9a04f9b8ef4a", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "6478c161bc60244f41cd5847cc3accd26d997883e9f7facd36ff24533b2fa579"}, "cloudevents": {:hex, :cloudevents, "0.6.1", "d3f467a615c00712cf3c9632f6d131695fd3e1d29c10477d2d2fbbec06350522", [:mix], [{:avrora, "~> 0.21", [hex: :avrora, repo: "hexpm", optional: true]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "f0055549bc651bd6702347328dd5824d3f08fbf308d2c7212252e34e345bcb9c"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"}, + "credo": {:hex, :credo, "1.6.6", "f51f8d45db1af3b2e2f7bee3e6d3c871737bda4a91bff00c5eec276517d1a19c", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "625520ce0984ee0f9f1f198165cd46fa73c1e59a17ebc520038b8fce056a5bdc"}, "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, "dart_sass": {:hex, :dart_sass, "0.5.0", "c52ad951d9bf611399b6d5efbf404f58dc3a699753662081fbcd4752c6ddeed0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "bb76938174af8e047e855d3bb83e84ceca17e9acbf1ac6429f9d18171da4a911"}, - "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, - "ed25519": {:hex, :ed25519, "1.4.0", "3eee373a77c8230ac25ab1d557f436eb6ec584946d7b76ca311f9fa18db84b55", [:mix], [], "hexpm", "420b52c68e2eda14a822c1d15df6c3e386f7b604d4351d6621a2f6baa68ed6dd"}, - "erlavro": {:hex, :erlavro, "2.9.7", "4880ed3d92bb07c89d20db13bc51300bcaa691a602ae2bd2859c6e760e322b38", [:make, :rebar, :rebar3], [{:jsone, "1.4.6", [hex: :jsone, repo: "hexpm", optional: false]}, {:snappyer, "1.2.8", [hex: :snappyer, repo: "hexpm", optional: false]}], "hexpm", "4d2a16892b640bd45e1cffb65d472328b1badf252ea061cbbb73df560ddc5941"}, + "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, + "ed25519": {:hex, :ed25519, "1.4.1", "479fb83c3e31987c9cad780e6aeb8f2015fb5a482618cdf2a825c9aff809afc4", [:mix], [], "hexpm", "0dacb84f3faa3d8148e81019ca35f9d8dcee13232c32c9db5c2fb8ff48c80ec7"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "esbuild": {:hex, :esbuild, "0.5.0", "d5bb08ff049d7880ee3609ed5c4b864bd2f46445ea40b16b4acead724fb4c4a3", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "f183a0b332d963c4cfaf585477695ea59eef9a6f2204fdd0efa00e099694ffe5"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "floki": {:hex, :floki, "0.32.1", "dfe3b8db3b793939c264e6f785bca01753d17318d144bd44b407fb3493acaa87", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "d4b91c713e4a784a3f7b1e3cc016eefc619f6b1c3898464222867cafd3c681a3"}, - "gettext": {:hex, :gettext, "0.19.1", "564953fd21f29358e68b91634799d9d26989f8d039d7512622efb3c3b1c97892", [:mix], [], "hexpm", "10c656c0912b8299adba9b061c06947511e3f109ab0d18b44a866a4498e77222"}, + "floki": {:hex, :floki, "0.33.1", "f20f1eb471e726342b45ccb68edb9486729e7df94da403936ea94a794f072781", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "461035fd125f13fdf30f243c85a0b1e50afbec876cbf1ceefe6fddd2e6d712c6"}, + "gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, "gnat": {:hex, :gnat, "1.5.2", "37c770aa4e7368b3add43a54c7be10ba90563578f8ba4a646e6f9aca7886f9fa", [:mix], [{:cowlib, "~> 2.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:nkeys, "~> 0.2", [hex: :nkeys, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c753f48121f054eadd94bc6546e3aed2c6c2f7c98d4c163d229336c5ca9b6316"}, "gproc": {:hex, :gproc, "0.8.0", "cea02c578589c61e5341fce149ea36ccef236cc2ecac8691fba408e7ea77ec2f", [:rebar3], [], "hexpm", "580adafa56463b75263ef5a5df4c86af321f68694e7786cb057fd805d1e2a7de"}, - "grpcbox": {:hex, :grpcbox, "0.14.0", "3eb321bcd2275baf8b54cf381feb7b0559a50c02544de28fda039c7f2f9d1a7a", [:rebar3], [{:acceptor_pool, "~>1.0.0", [hex: :acceptor_pool, repo: "hexpm", optional: false]}, {:chatterbox, "~>0.11.0", [hex: :ts_chatterbox, repo: "hexpm", optional: false]}, {:ctx, "~>0.6.0", [hex: :ctx, repo: "hexpm", optional: false]}, {:gproc, "~>0.8.0", [hex: :gproc, repo: "hexpm", optional: false]}], "hexpm", "e24159b7b6d3f9869bbe528845c0125fed2259366ba908fd04a1f45fe81d0660"}, + "grpcbox": {:hex, :grpcbox, "0.15.0", "97c7126296a091602d372ebf5860a04f7bc795b45b33a984cad2b8e362774fd8", [:rebar3], [{:acceptor_pool, "~>1.0.0", [hex: :acceptor_pool, repo: "hexpm", optional: false]}, {:chatterbox, "~>0.12.0", [hex: :ts_chatterbox, repo: "hexpm", optional: false]}, {:ctx, "~>0.6.0", [hex: :ctx, repo: "hexpm", optional: false]}, {:gproc, "~>0.8.0", [hex: :gproc, repo: "hexpm", optional: false]}], "hexpm", "161abe9e17e7d1982efa6488adeaa13c3e847a07984a6e6b224e553368918647"}, "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, "hashids": {:hex, :hashids, "2.0.5", "d9839924c8221b954da8b110eda3e59c2c03df0389bac6e7d0e535f937033df1", [:mix], [], "hexpm", "ef47d8679f20d7bea59d0d49c202258c89f61b9b741bd3dceef2c1985cf95554"}, "hpack": {:hex, :hpack_erl, "0.2.3", "17670f83ff984ae6cd74b1c456edde906d27ff013740ee4d9efaa4f1bf999633", [:rebar3], [], "hexpm", "06f580167c4b8b8a6429040df36cc93bba6d571faeaec1b28816523379cbb23a"}, "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, - "jsone": {:hex, :jsone, "1.4.6", "644d6d57befb22c8e19b324dee19d73b1c004565009861a8f64c68b7b9e64dbf", [:rebar3], [], "hexpm", "78eee8bb38f0bee2e73673d71bc75fc6fb01f56f0d23e769a26eee3655487a38"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, + "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "msgpax": {:hex, :msgpax, "2.3.0", "14f52ad249a3f77b5e2d59f6143e6c18a6e74f34666989e22bac0a465f9835cc", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "65c36846a62ed5615baf7d7d47babb6541313a6c0b6d2ff19354bd518f52df7e"}, "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, @@ -45,7 +41,7 @@ "opentelemetry_logger_metadata": {:hex, :opentelemetry_logger_metadata, "0.1.0", "0d1b7a4669521d75b142c9c9585771ed0707ccd515312cf06135c5bfc5c60ab9", [:mix, :rebar3], [{:opentelemetry_api, "~> 1.0", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "772976d3c59651cf9c4600edc238bb9cadf7f5edaed1a1c5c59bf3e773dfe9fc"}, "parallel_task": {:hex, :parallel_task, "0.1.1", "d65477457a9415b98c11b73c4f36886f3b24677595ff792ec8f460ad69725313", [:mix], [], "hexpm", "06cf5db089fddd264158a3dd7b3b87ace7682df72bb62799d50818c37a468b6d"}, "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, - "phoenix": {:hex, :phoenix, "1.6.10", "7a9e8348c5c62e7fd2f74a1884b88d98251f87186a430048bfbdbab3e3f46736", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "08cf70d42f61dd0ea381805bac3cddef57b7b92ade5acc6f6036aa25ecaca9a2"}, + "phoenix": {:hex, :phoenix, "1.6.11", "29f3c0fd12fa1fc4d4b05e341578e55bc78d96ea83a022587a7e276884d397e4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1664e34f80c25ea4918fbadd957f491225ef601c0e00b4e644b1a772864bfbc2"}, "phoenix_html": {:hex, :phoenix_html, "3.0.4", "232d41884fe6a9c42d09f48397c175cd6f0d443aaa34c7424da47604201df2e1", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "ce17fd3cf815b2ed874114073e743507704b1f5288bb03c304a77458485efc8b"}, "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.5.3", "ff153c46aee237dd7244f07e9b98d557fe0d1de7a5916438e634c3be2d13c607", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:phoenix_live_view, "~> 0.16.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "e36e62b1f61c19b645853af78290a5e7900f7cae1e676714ff69f9836e2f2e76"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, @@ -54,17 +50,16 @@ "phoenix_view": {:hex, :phoenix_view, "1.1.2", "1b82764a065fb41051637872c7bd07ed2fdb6f5c3bd89684d4dca6e10115c95a", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "7ae90ad27b09091266f6adbb61e1d2516a7c3d7062c6789d46a7554ec40f3a56"}, "plug": {:hex, :plug, "1.13.6", "187beb6b67c6cec50503e940f0434ea4692b19384d47e5fdfd701e93cadb4cc2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02b9c6b9955bce92c829f31d6284bf53c591ca63c4fb9ff81dfd0418667a34ff"}, "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "rustler": {:hex, :rustler, "0.24.0", "b8362a2fee1c9d2c7373b0bfdc98f75bbc02864efcec50df173fe6c4f72d4cc4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "2773167fca68a6525822ad977b41368ea3c2af876c42ebaa7c9d6bb69b67f1ce"}, "rustler_precompiled": {:hex, :rustler_precompiled, "0.5.1", "93df423bd7b14b67dcacf994443d132d300623f80756974cac4febeab40af74a", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "3f8cbc8e92eef4e1a71bf441b568b868b16a3730f63f5b803c68073017e30b13"}, - "snappyer": {:hex, :snappyer, "1.2.8", "201ce9067a33c71a6a5087c0c3a49a010b17112d461e6df696c722dcb6d0934a", [:rebar3], [], "hexpm", "35518e79a28548b56d8fd6aee2f565f12f51c2d3d053f9cfa817c83be88c4f3d"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_poller": {:hex, :telemetry_poller, "0.5.1", "21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a", [:rebar3], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4"}, - "timex": {:hex, :timex, "3.7.8", "0e6e8bf7c0aba95f1e13204889b2446e7a5297b1c8e408f15ab58b2c8dc85f81", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8f3b8edc5faab5205d69e5255a1d64a83b190bab7f16baa78aefcb897cf81435"}, - "tls_certificate_check": {:hex, :tls_certificate_check, "1.14.0", "6d1638d56ac68b25c987d401dffb7cd059281339aadc3f8bf27ab33ee19ddbfe", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "b4452ddd3ae89cd84451afa0e218cb3ccd5178fe3c1de7fabcbddb12a137bcf4"}, + "timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"}, + "tls_certificate_check": {:hex, :tls_certificate_check, "1.15.0", "1c0377617a1111000bca3f4cd530b62690c9bd2dc9b868b4459203cd4d7f16ab", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "87fd2e865078fdf8913a8c27bd8fe2be986383e31011f21d7f92cc5f7bc90731"}, "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, From 64442e0988a92b7fb63411fbd09cfe94edee9616 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Wed, 24 Aug 2022 12:25:48 -0400 Subject: [PATCH 6/8] v1 final Signed-off-by: Brooks Townsend --- .github/workflows/host_core.yml | 2 +- .github/workflows/release.yml | 16 ++++++++++------ .github/workflows/wasmcloud_host.yml | 4 ++-- wasmcloud_host/Makefile | 5 ----- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/host_core.yml b/.github/workflows/host_core.yml index 9e0475cd..b19810cd 100644 --- a/.github/workflows/host_core.yml +++ b/.github/workflows/host_core.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-20.04, windows-2019, macos-10.15] elixir: [1.13.4] - otp: [24.3, 25] + otp: [25] name: Build and test runs-on: ${{ matrix.os }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15d9182c..92dd78db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -230,12 +230,14 @@ jobs: APP_VSN=${{ env.app-version }} MIX_ENV=${{ env.MIX_ENV }} tags: | - wasmcloud.azurecr.io/strictlytesting${{ env.app-name }}:${{ env.app-version }} + wasmcloud.azurecr.io/${{ env.app-name }}:${{ env.app-version }} + wasmcloud.azurecr.io/${{ env.app-name }}:latest + wasmcloud/${{ env.app-name }}:${{ env.app-version }} + wasmcloud/${{ env.app-name }}:latest - # docker run --rm --platform linux/arm64/v8 -iv ${PWD}:/aarch64temp wasmcloud/${{ env.app-name }}:${{ env.app-version}} sh -s < Date: Wed, 24 Aug 2022 12:47:10 -0400 Subject: [PATCH 7/8] reintroduced tag restrictions on actions Signed-off-by: Brooks Townsend backed out a few mix.lock changes Signed-off-by: Brooks Townsend --- .github/workflows/release.yml | 8 ++++---- wasmcloud_host/mix.lock | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92dd78db..b8737b1d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ env: jobs: compile-native-nif: # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} name: Compile NIFs env: working-directory: ./host_core/native/hostcore_wasmcloud_native @@ -50,7 +50,7 @@ jobs: create-mix-releases: # Run on tag push or on manual dispatch. Release will not be created for manual dispatch - # if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + if: ${{ startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} needs: compile-native-nif name: Mix release strategy: @@ -171,7 +171,7 @@ jobs: path: ${{env.working-directory}}/${{ matrix.release-tarball }} release-hostcore-docker: - # if: startswith(github.ref, 'refs/tags/') # Only run on tag push + if: startswith(github.ref, 'refs/tags/') # Only run on tag push needs: compile-native-nif name: Release Image (host_core) runs-on: ubuntu-22.04 @@ -254,7 +254,7 @@ jobs: # # So, sorry about the code duplication, perhaps in the future we'll find a way to make this happen release-wasmcloud-docker: - # if: startswith(github.ref, 'refs/tags/') # Only run on tag push + if: startswith(github.ref, 'refs/tags/') # Only run on tag push needs: compile-native-nif name: Release Image (wasmcloud_host) runs-on: ubuntu-22.04 diff --git a/wasmcloud_host/mix.lock b/wasmcloud_host/mix.lock index 6a8d8e7c..39af9707 100644 --- a/wasmcloud_host/mix.lock +++ b/wasmcloud_host/mix.lock @@ -1,7 +1,7 @@ %{ "acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, - "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, + "castore": {:hex, :castore, "0.1.17", "ba672681de4e51ed8ec1f74ed624d104c0db72742ea1a5e74edbc770c815182f", [:mix], [], "hexpm", "d9844227ed52d26e7519224525cb6868650c272d4a3d327ce3ca5570c12163f9"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "chatterbox": {:hex, :ts_chatterbox, "0.12.0", "4e54f199e15c0320b85372a24e35554a2ccfc4342e0b7cd8daed9a04f9b8ef4a", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "6478c161bc60244f41cd5847cc3accd26d997883e9f7facd36ff24533b2fa579"}, "cloudevents": {:hex, :cloudevents, "0.6.1", "d3f467a615c00712cf3c9632f6d131695fd3e1d29c10477d2d2fbbec06350522", [:mix], [{:avrora, "~> 0.21", [hex: :avrora, repo: "hexpm", optional: true]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "hexpm", optional: false]}], "hexpm", "f0055549bc651bd6702347328dd5824d3f08fbf308d2c7212252e34e345bcb9c"}, @@ -59,7 +59,7 @@ "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_poller": {:hex, :telemetry_poller, "0.5.1", "21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a", [:rebar3], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4"}, "timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"}, - "tls_certificate_check": {:hex, :tls_certificate_check, "1.15.0", "1c0377617a1111000bca3f4cd530b62690c9bd2dc9b868b4459203cd4d7f16ab", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "87fd2e865078fdf8913a8c27bd8fe2be986383e31011f21d7f92cc5f7bc90731"}, + "tls_certificate_check": {:hex, :tls_certificate_check, "1.14.0", "6d1638d56ac68b25c987d401dffb7cd059281339aadc3f8bf27ab33ee19ddbfe", [:rebar3], [{:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "b4452ddd3ae89cd84451afa0e218cb3ccd5178fe3c1de7fabcbddb12a137bcf4"}, "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, From 228f5b30ad1d09e6d003ffa5323c213056aa9211 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Wed, 24 Aug 2022 14:04:18 -0400 Subject: [PATCH 8/8] removed unneeded steps in dockerfile Signed-off-by: Brooks Townsend --- wasmcloud_host/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/wasmcloud_host/Dockerfile b/wasmcloud_host/Dockerfile index 06692c7b..482268d9 100644 --- a/wasmcloud_host/Dockerfile +++ b/wasmcloud_host/Dockerfile @@ -19,9 +19,6 @@ WORKDIR /opt/app COPY ./host_core ./host_core COPY ./wasmcloud_host ./wasmcloud_host -RUN cat /etc/os-release -RUN uname -a - # Install necessary system dependencies RUN apt update && \ DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \