Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
  • Loading branch information
rissson committed Feb 1, 2024
1 parent 2b080fc commit 870d3dd
Show file tree
Hide file tree
Showing 7 changed files with 904 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!entrypoint.sh
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: main

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ludeeus/[email protected]
ci-mark:
needs:
- lint
runs-on: ubuntu-latest
steps:
- run: echo mark
build:
needs: ci-mark
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: docker/[email protected]
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: ev
run: |
if [ -z "${{ github.event.pull_request.head.sha }}" ]; then
echo "sha=${GITHUB_SHA}" > "${GITHUB_OUTPUT}"
else
echo "sha=${{ github.event.pull_request.head.sha }}" > "${GITHUB_OUTPUT}"
fi
- uses: docker/build-push-action@v5
with:
context: .
push: "${{ github.ref == 'refs/heads/main' }}"
tags: |
ghcr.io/authentik-community/krb5:${{ steps.ev.outputs.sha }}
platforms: linux/amd64,linux/arm64
build-args: |
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: release

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: docker/[email protected]
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: ev
run: |
echo "version=${GITHUB_REF#refs/tags/version/}" > "${GITHUB_OUTPUT}"
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/authentik-community/krb5:${{ steps.ev.outputs.version }}
ghcr.io/authentik-community/krb5:latest
platforms: linux/amd64,linux/arm64
build-args: |
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
VERSION=${{ steps.ev.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1

FROM debian:12

ARG GIT_BUILD_HASH
ARG VERSION

LABEL org.opencontainers.image.url https://github.com/authentik-community/krb5-docker
LABEL org.opencontainers.image.description Run an MIT Kerberos 5 KDC in a container
LABEL org.opencontainers.image.source https://github.com/authentik-community/krb5-docker.git
LABEL org.opencontainers.image.version ${VERSION}
LABEL org.opencontainers.image.revision ${GIT_BUILD_HASH}

ENV KRB5_CONFIG=/etc/krb5.conf \
KRB5_KDC_PROFILE=/etc/krb5kdc/kdc.conf \
KRB5_DATA_DIR=/var/lib/krb5kdc

RUN apt-get update && \
apt-get install -y --no-install-recommends pwgen krb5-kdc krb5-admin-server krb5-kdc-ldap krb5-k5tls krb5-otp krb5-pkinit krb5-strength && \
apt-get clean && \
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/ && \
adduser --system --no-create-home --uid 1000 --group --home /var/lib/krb5kdc krb5kdc && \
mkdir -p /var/lib/krb5kdc && \
rm -rf /var/lib/krb5kdc/* && \
echo > /etc/krb5.conf && \
echo > /etc/krb5kdc/kdc.conf && \
chown -R krb5kdc:krb5kdc /var/lib/krb5kdc /etc/krb5.conf /etc/krb5kdc

COPY ./entrypoint.sh /entrypoint.sh

USER 1000

WORKDIR /var/lib/krb5kdc

ENTRYPOINT [ "/entrypoint.sh" ]
Loading

0 comments on commit 870d3dd

Please sign in to comment.