Skip to content

Commit

Permalink
Merge pull request #75 from mlibrary/debpkgs
Browse files Browse the repository at this point in the history
Create Debian Packages from Build Base for installation on Apache
  • Loading branch information
botimer authored Apr 30, 2024
2 parents 1622239 + e347afe commit 380590c
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 590 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/branch-scratch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ on:
workflow_dispatch:
inputs:
tag:
default: 'latest-default-tag'
description: tag
required: true

jobs:
get-short-tag:
id: get-short-tag
runs-on: ubuntu-latest
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: save short tag to environment
run: echo "short_tag=$(echo ${{ github.event.inputs.tag }} | head -c 8 )" >> $GITHUB_ENV
- name: echo env var
run: echo "${{ github.env.short_tag }}"
run: echo "${{ env.short_tag }}"
- name: arch
run: ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/); echo $ARCH
- name: env
run: env
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ apache/client/subprojects/*
!apache/client/subprojects/*.wrap

apache/client/build/

# Debian Packages
apache/packages
!apache/packages/.keep
60 changes: 49 additions & 11 deletions apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,56 @@ RUN meson configure -Dtests=true -Dintegration-tests=true && meson compile
CMD ["meson", "test", "-v"]

###
FROM httpd:2.4-bullseye AS server
RUN sed -i '1c#!/usr/bin/perl' /usr/local/apache2/cgi-bin/printenv
RUN chmod +x /usr/local/apache2/cgi-bin/printenv
FROM build-base AS packages

RUN mkdir -p /lauth
COPY ./apache/debpkgs /lauth/apache/debpkgs
WORKDIR /lauth/apache/debpkgs

COPY --from=module /lauth/apache/build/http-check /usr/local/bin/
COPY --from=module /usr/local/ /usr/local/
RUN ldconfig
# http-check
COPY --from=module /lauth/apache/build/http-check /lauth/apache/debpkgs/http-check/usr/bin/
RUN ./package http-check

COPY --from=module /usr/lib/apache2/modules/mod_authn_remoteuser.so /usr/local/apache2/modules/
COPY --from=module /usr/lib/apache2/modules/mod_lauth.so /usr/local/apache2/modules/
# mod-authn-remoteuser
COPY --from=module /usr/lib/apache2/modules/mod_authn_remoteuser.so /lauth/apache/debpkgs/mod-authn-remoteuser/usr/lib/apache2/modules/
RUN ./package mod-authn-remoteuser

COPY ./test-site /lauth/test-site/
COPY ./apache/conf/* /usr/local/apache2/conf/
# mod-lauth
COPY --from=module /usr/local/ /lauth/apache/debpkgs/mod-lauth/usr/
COPY --from=module /usr/lib/apache2/modules/mod_lauth.so /lauth/apache/debpkgs/mod-lauth/usr/lib/apache2/modules/
RUN ./package mod-lauth

# Docker Compose Volume Mapping Directory
COPY ./apache/packages /lauth/apache/packages

##
FROM debian:bullseye-slim AS server
RUN apt update; \
apt install -y --no-install-recommends \
ca-certificates \
apache2

# enable available apache2 modules
RUN a2enmod authz_groupfile cgid headers proxy proxy_http remoteip rewrite

# install debian packages: http-check, mod-authn-remoteuser, mod-lauth
COPY --from=packages /lauth/apache/debpkgs/*.deb /tmp
RUN dpkg -i /tmp/*.deb
RUN rm -f /tmp/*.deb

# enable apache2 modules: lauth
RUN a2enmod lauth

CMD ["apache2ctl", "-D", "FOREGROUND"]

##
FROM server AS test-server

# enable apache2 modules: authn-remoteuser
RUN a2enmod authn_remoteuser

COPY ./test-site /lauth/test-site
COPY ./apache/conf/test-site.conf /etc/apache2/sites-available/test-site.conf
RUN a2ensite test-site
RUN a2dissite 000-default

RUN cp /lauth/test-site/cgi/printenv /usr/lib/cgi-bin/
Loading

0 comments on commit 380590c

Please sign in to comment.