-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from thalesmg/docker-release
ci: add docker image to release
- Loading branch information
Showing
6 changed files
with
102 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,3 +78,51 @@ jobs: | |
files: packages/* | ||
draft: ${{ github.ref_type != 'tag' }} | ||
prerelease: ${{ github.ref_type != 'tag' }} | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu24.04 | ||
needs: | ||
- init | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.event.inputs.ref }} | ||
- name: Compute RUN_FROM | ||
id: run_from | ||
run: | | ||
RUN_FROM=$(./scripts/compute-run-from.sh ${{ matrix.os }}) | ||
echo "RUN_FROM=$RUN_FROM" | tee -a "$GITHUB_OUTPUT" | ||
- name: Docker Metadata action | ||
uses: docker/[email protected] | ||
id: meta | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
- uses: docker/setup-buildx-action@v2 | ||
- uses: docker/setup-qemu-action@v2 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Build and push Docker images | ||
uses: docker/[email protected] | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
BUILD_FROM=ghcr.io/emqx/emqx-builder/${{ needs.init.outputs.BUILDER_VSN }}:${{ needs.init.outputs.ELIXIR_VSN }}-${{ needs.init.outputs.OTP_VSN }}-${{ matrix.os }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ rebar.lock | |
Mnesia* | ||
TAGS | ||
emqx-export*.tar.gz | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ARG BUILD_FROM | ||
ARG RUN_FROM=ubuntu:24.04 | ||
|
||
FROM ${BUILD_FROM} AS builder | ||
Check warning on line 4 in Dockerfile GitHub Actions / docker (ubuntu24.04)Default value for global ARG results in an empty or invalid base image name
|
||
|
||
COPY . /build | ||
|
||
WORKDIR /build | ||
|
||
RUN /build/build | ||
|
||
FROM ${RUN_FROM} AS runner | ||
|
||
WORKDIR /opt/converter | ||
|
||
COPY --from=builder /build/dist/. /opt/converter/. | ||
|
||
ENTRYPOINT ["/opt/converter/bin/emqx_data_converter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
rebar3 escriptize | ||
|
||
DIST_DIR="${DIST_DIR:-dist}" | ||
|
||
ERL_ROOT=$(erl -noinput -eval 'io:format("~s",[code:root_dir()]),halt().') | ||
ERL_DIR=$(basename $ERL_ROOT) | ||
rm -rf "$DIST_DIR" | ||
cp -R ${ERL_ROOT%/} _build/ | ||
mv _build/default/bin/emqx_data_converter _build/$ERL_DIR/bin/emqx_data_converter.escript | ||
cp -f _build/$ERL_DIR/bin/escript _build/$ERL_DIR/bin/emqx_data_converter | ||
mkdir "$DIST_DIR" | ||
mv _build/$ERL_DIR/* "$DIST_DIR/." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
case "$1" in | ||
ubuntu*) | ||
VSN=${1#ubuntu} | ||
echo "ubuntu:$VSN" | ||
;; | ||
*) | ||
echo "unsupported OS: $1" | ||
exit 1 | ||
;; | ||
esac |