-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
381 additions
and
24 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
name: CI | ||
|
||
name: Docker Build OTP 25 | ||
on: | ||
workflow_dispatch: | ||
push: | ||
|
@@ -65,10 +64,10 @@ jobs: | |
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./deployment/Dockerfile | ||
file: ./deployment/otp25/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: leapsight/${{ steps.meta.outputs.tags }} | ||
tags: leapsight/${{ steps.meta.outputs.tags }}-otp25 | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache | ||
cache-to: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache,mode=max | ||
|
@@ -78,25 +77,25 @@ jobs: | |
name: Copy Image to multiple registries | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }} | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-otp25 | ||
dst: | | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }} | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-otp25 | ||
- | ||
name: Build and push alpine image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./deployment/alpine.Dockerfile | ||
file: ./deployment/otp25/alpine.Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine | ||
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine-otp25 | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- | ||
# Copy multiplatform image from dockerhub to multiple registries | ||
# without changing the image SHA | ||
name: Copy Image to multiple registries | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine-otp25 | ||
dst: | | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine-otp25 |
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,109 @@ | ||
name: Docker Build OTP 26: | ||
workflow_dispatch: | ||
push: | ||
branches : [develop, master] | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
name: Build an publish docker images to multiple registries | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
# without registry name, we will add it in the build-push-action as | ||
# each registry has diff namespace at the moment | ||
images: | | ||
bondy | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
flavor: | | ||
latest=false | ||
prefix= | ||
suffix= | ||
labels: | | ||
maintainer=Leapsight | ||
org.opencontainers.image.title=Bondy | ||
org.opencontainers.image.description=Bondy is an open source, always-on and scalable application networking platform connecting all elements of a distributed application—offering event and service mesh capabilities combined. From web and mobile apps to IoT devices and backend microservices, Bondy allows everything to talk using one simple communication protocol. | ||
org.opencontainers.image.vendor=Leapsight | ||
- | ||
name: Build, cache and push standard image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./deployment/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: leapsight/${{ steps.meta.outputs.tags }},leapsight/${{ steps.meta.outputs.tags }}-otp26 | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache | ||
cache-to: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache,mode=max | ||
- | ||
# Copy multiplatform image from dockerhub to multiple registries | ||
# without changing the image SHA | ||
name: Copy Image to multiple registries | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }} | ||
dst: | | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }} | ||
- | ||
name: Build and push alpine image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./deployment/alpine.Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine,leapsight/${{ steps.meta.outputs.tags }}-alpine-otp26 | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- | ||
# Copy multiplatform image from dockerhub to multiple registries | ||
# without changing the image SHA | ||
name: Copy Image to multiple registries | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine | ||
dst: | | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine | ||
- | ||
# Copy multiplatform image from dockerhub to multiple registries | ||
# without changing the image SHA | ||
name: Copy Image to multiple registries | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine-otp26 | ||
dst: | | ||
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine-otp26 |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{minimum_otp_vsn, "R26.0.2"}. | ||
{minimum_otp_vsn, "R25.3.2.12"}. | ||
{erl_opts, [debug_info]}. | ||
{deps, [ | ||
%% Core deps | ||
|
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
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,107 @@ | ||
# syntax=docker/dockerfile:1.3 | ||
|
||
# =========================================================================== | ||
# Build stage 1 | ||
# =========================================================================== | ||
|
||
FROM erlang:25.3.2.12 AS builder | ||
|
||
# Install build dependencies | ||
RUN --mount=type=cache,id=apt,sharing=locked,target=/var/cache/apt apt-get update && \ | ||
apt-get -y install --no-install-recommends build-essential git libssl-dev libsodium-dev libsnappy-dev curl && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /bondy/src | ||
|
||
# Copy Bondy project source to working dir | ||
COPY ../ /bondy/src | ||
|
||
# Create dir we will unpack release tar into | ||
RUN mkdir -p /bondy/rel | ||
|
||
# Generates tar in /bondy/src/_build and untars in /bondy/rel | ||
RUN rebar3 as docker tar && \ | ||
tar -zxvf /bondy/src/_build/docker/rel/*/*.tar.gz -C /bondy/rel/ | ||
|
||
|
||
# =========================================================================== | ||
# Build stage 2 | ||
# =========================================================================== | ||
|
||
FROM debian:bullseye-slim as runner | ||
|
||
# We define defaults | ||
# We assume you have DNS. Erlang will take the FQDN and generate | ||
# a node name == ${BONDY_ERL_NODENAME}@${FQDN} | ||
ENV [email protected] | ||
ENV BONDY_ERL_DISTRIBUTED_COOKIE=bondy | ||
ENV BONDY_LOG_CONSOLE=console | ||
ENV BONDY_LOG_LEVEL=info | ||
ENV ERL_CRASH_DUMP=/dev/null | ||
ENV ERL_DIST_PORT=27780 | ||
|
||
# We add Bondy executables to PATH | ||
ENV PATH="/bondy/bin:$PATH" | ||
# This is required so that relx replaces the vm.args | ||
# BONDY_ERL_NODENAME and BONDY_ERL_DISTRIBUTED_COOKIE variables | ||
ENV RELX_REPLACE_OS_VARS=true | ||
|
||
ENV HOME "/bondy" | ||
|
||
# We install the following utils: | ||
# - bash | ||
# - procps: which includes the commands free, kill, pkill, pgrep, pmap, ps, | ||
# pwdx, skill, slabtop, snice, sysctl, tload, top, uptime, vmstat, w, and | ||
# watch | ||
# - iproute2: a collection of utilities for networking and traffic control. | ||
# - net-tools: which includes the commands arp, ifconfig, netstat, rarp, nameif | ||
# and route | ||
# - curl, jq: for devops to use the REST Admin API | ||
# - nano: for devops | ||
# | ||
# We install the following required packages: | ||
# - openssl: required by Erlang crypto application | ||
# - libsodium: required by enacl application | ||
# We setup the bondy group and user and the /bondy dir | ||
# We also create the /bondy/etc dir to avoid an issue when deploying in K8s | ||
# where the permissions are not assigned to the directory and Bondy will not | ||
# have permission to write. | ||
RUN apt-get update \ | ||
&& apt-get -y install \ | ||
sudo bash procps iproute2 net-tools dnsutils curl jq nano \ | ||
openssl libsodium-dev libsnappy-dev\ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& groupadd -g 1000 -r bondy \ | ||
&& useradd -u 1000 -r -g bondy -d /bondy -s /bin/bash -c "bondy" bondy \ | ||
&& mkdir -p /bondy/etc \ | ||
&& chown bondy:bondy /bondy/etc | ||
|
||
WORKDIR /bondy | ||
USER bondy:bondy | ||
|
||
# Copy the release to workdir | ||
COPY --chown=bondy:bondy --from=builder /bondy/rel . | ||
|
||
# Define which ports are intended to be published | ||
# We are hardcoding the ports here, the bondy.conf definitions need to match | ||
# these! | ||
# API GATEWAY HTTP and WS (Default: 18080) | ||
EXPOSE 18080/tcp | ||
# ADMIN API HTTP (Default: 18081) | ||
EXPOSE 18081/tcp | ||
# WAMP TCP (Default: 18082) | ||
EXPOSE 18082/tcp | ||
# API GATEWAY HTTPS and WSS (Default: 18083) | ||
EXPOSE 18083/tcp | ||
# ADMIN API HTTPS (Default: 18084) | ||
EXPOSE 18084/tcp | ||
# WAMP TLS (Default: 18085) | ||
EXPOSE 18085/tcp | ||
# CLUSTER PEER SERVICE (Default: 18086) | ||
EXPOSE 18086/tcp | ||
|
||
# The pre_start script will hardcode the following paths i.e. ignoring the | ||
# user-defined environment variables (BONDY_*_DIR) | ||
VOLUME ["/bondy/etc", "/bondy/data", "/bondy/log", "/bondy/tmp"] | ||
|
||
ENTRYPOINT ["bondy", "foreground"] |
Oops, something went wrong.