Skip to content

Commit

Permalink
Merge pull request #1 from nerc-project/add-apache2-build
Browse files Browse the repository at this point in the history
Add github actions build for apache2 container
  • Loading branch information
aabaris authored Oct 20, 2023
2 parents e733166 + 1dd433a commit 1483a47
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build

on:
push:
branches: [main]
# Publish semver tags as releases.
tags: ['v*.*.*']
pull_request:
branches: [main]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM debian:12
RUN apt update
RUN apt install -y apache2
RUN apt install -y libapache2-mod-wsgi-py3
RUN apt install -y libapache2-mod-auth-openidc
RUN a2enmod wsgi
RUN a2enmod proxy
RUN a2enmod proxy_http
RUN a2enmod headers
RUN a2enmod ssl
RUN a2enmod rewrite
RUN a2enmod auth_openidc
RUN a2ensite default-ssl
COPY files/apache2-foreground /usr/bin/apache2-foreground
RUN chmod 755 /usr/bin/apache2-foreground
CMD /usr/bin/apache2-foreground
10 changes: 10 additions & 0 deletions files/apache2-foreground
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

export APACHE_RUN_DIR=/var/run/apache2
export APACHE_ARGUMENTS="-DFOREGROUND $@"

# Apache gets grumpy about PID files pre-existing
rm -f ${APACHE_RUN_DIR}/apache2.pid

exec /usr/sbin/apachectl start

0 comments on commit 1483a47

Please sign in to comment.