25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Use installer output as container image input

This commit is contained in:
Saarko 2024-07-20 19:12:59 +02:00
parent 2129d8aae7
commit 4aa973fef5
3 changed files with 47 additions and 72 deletions

View File

@ -1,7 +1,7 @@
#' Define default build variables #' Define default build variables
## source ARGs ## source ARGs
ARG OTP_VSN='27' ARG OTP_VSN='27'
ARG ELIXIR_VSN='1.16.3' ARG ELIXIR_VSN='1.17.2'
## general ARGs ## general ARGs
ARG UID='9000' ARG UID='9000'
ARG USER='ejabberd' ARG USER='ejabberd'
@ -102,14 +102,28 @@ RUN home_root_dir=$(echo $HOME | sed 's|\(.*\)/.*|\1 |') \
&& ARCH=$(uname -m | sed -e 's/x86_64/x64/;s/aarch64/arm64/') \ && ARCH=$(uname -m | sed -e 's/x86_64/x64/;s/aarch64/arm64/') \
&& tar -xzf /tmp/ejabberd-*-linux-musl-$ARCH.tar.gz -C $home_root_dir && tar -xzf /tmp/ejabberd-*-linux-musl-$ARCH.tar.gz -C $home_root_dir
################################################################################
#' OpenSSL - Create server certificate for localhost,
# because wolfi misses openssl config file
FROM docker.io/library/alpine AS servercert
RUN apk -U add --no-cache openssl
RUN export PEM=/tmp/server.pem \
&& openssl req -x509 \
-batch \
-nodes \
-newkey rsa:4096 \
-keyout $PEM \
-out $PEM \
-days 3650 \
-subj "/CN=localhost"
################################################################################ ################################################################################
#' Prepare ejabberd for runtime #' Prepare ejabberd for runtime
FROM ${METHOD} AS ejabberd FROM ${METHOD} AS ejabberd
RUN apk -U add --no-cache \ RUN apk -U add --no-cache \
git \ git \
libcap-utils \ libcap-utils \
pax-utils \ pax-utils
openssl
WORKDIR /rootfs WORKDIR /rootfs
ARG HOME ARG HOME
@ -125,17 +139,7 @@ RUN if [ ! -d $HOME/.ejabberd-modules ]; \
fi \ fi \
fi fi
RUN export PEM=$HOME/conf/server.pem \ COPY --from=servercert /tmp/server.pem $HOME/conf/server.pem
&& wget -O /etc/ssl/openssl.cnf \
https://raw.githubusercontent.com/openssl/openssl/openssl-3.3/apps/openssl.cnf \
&& openssl req -x509 \
-batch \
-nodes \
-newkey rsa:4096 \
-keyout $PEM \
-out $PEM \
-days 3650 \
-subj "/CN=localhost"
RUN home_root_dir=$(echo $HOME | sed 's|\(.*\)/.*|\1 |') \ RUN home_root_dir=$(echo $HOME | sed 's|\(.*\)/.*|\1 |') \
&& setcap 'cap_net_bind_service=+ep' $(find $home_root_dir -name beam.smp) \ && setcap 'cap_net_bind_service=+ep' $(find $home_root_dir -name beam.smp) \

View File

@ -1,16 +1,10 @@
name: Container name: Container
on: on:
schedule: workflow_run:
- cron: '22 2 */6 * *' # every 6 days to avoid gha cache being evicted workflows: [Installers]
push: types:
paths-ignore: - completed
- '.devcontainer/**'
- 'examples/**'
- 'lib/**'
- 'man/**'
- 'priv/**'
- '**.md'
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
@ -27,52 +21,13 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
-
# - name: Cache build directory name: Download digests
# uses: actions/cache@v4 uses: actions/download-artifact@v4
# with: with:
# path: ~/build/ path: tarballs
# key: ${{runner.os}}-ctr-ct-ng-1.26.0 pattern: tarballs
merge-multiple: true
# - name: Get erlang/OTP version for bootstrapping
# run: |
# echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.rc-]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
# echo "ELIXIR_VSN=$(awk '/^elixir_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
# - name: Install prerequisites
# run: |
# sudo apt-get -qq update
# sudo apt-get -qq install makeself
# # https://github.com/crosstool-ng/crosstool-ng/blob/master/testing/docker/ubuntu21.10/Dockerfile
# sudo apt-get -qq install build-essential autoconf bison flex gawk
# sudo apt-get -qq install help2man libncurses5-dev libtool libtool-bin
# sudo apt-get -qq install python3-dev texinfo unzip
# - name: Install erlang/OTP
# uses: erlef/setup-beam@v1
# with:
# otp-version: ${{ env.OTP_VSN }}
# elixir-version: ${{ env.ELIXIR_VSN }}
# version-type: strict
# - name: Remove Elixir Matchers
# run: |
# echo "::remove-matcher owner=elixir-mixCompileWarning::"
# echo "::remove-matcher owner=elixir-credoOutputDefault::"
# echo "::remove-matcher owner=elixir-mixCompileError::"
# echo "::remove-matcher owner=elixir-mixTestFailure::"
# echo "::remove-matcher owner=elixir-dialyzerOutputDefault::"
# - name: Build musl-libc based binary archives
# run: |
# sed -i "s|targets='.*'|targets='x86_64-linux-musl aarch64-linux-musl'|" tools/make-binaries
# mv .github/container/ejabberdctl.template .
# CHECK_DEPS=false tools/make-binaries
# - name: Collect packages
# run: |
# mkdir tarballs
# mv ejabberd-*.tar.gz tarballs
- name: Checkout ejabberd-contrib - name: Checkout ejabberd-contrib
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -111,13 +66,13 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
build-args: | build-args: |
METHOD=direct METHOD=package
VERSION=${{ steps.gitdescribe.outputs.ver }} VERSION=${{ steps.gitdescribe.outputs.ver }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
context: . context: .
file: .github/container/Dockerfile file: .github/container/Dockerfile
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64 # ,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}

View File

@ -66,6 +66,22 @@ jobs:
# #
path: ejabberd-packages* path: ejabberd-packages*
retention-days: 14 retention-days: 14
- name: Collect binary tarballs
run: |
mkdir tarballs
mv ejabberd-*.tar.gz tarballs
- name: Upload binary tarballs
uses: actions/upload-artifact@v4
with:
name: ejabberd-tarballs
#
# Appending the wildcard character ("*") is a trick to make
# "ejabberd-packages" the root directory of the uploaded ZIP file:
#
# https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
#
path: tarballs*
retention-days: 14
release: release:
name: Release name: Release