Add docker support for Trac and Gitea

Signed-off-by: Benoit Donneaux <benoit@leastauthority.com>
This commit is contained in:
bEn 2024-05-27 16:12:30 +02:00
commit 1852f1aa2d
6 changed files with 144 additions and 0 deletions

60
docker-compose.yml Normal file
View File

@ -0,0 +1,60 @@
# Docker compose file to support dev+ops activities
version: '3'
services:
trac:
build:
context: docker/trac
dockerfile: Dockerfile
args:
user: appuser
group: appgroup
uid: "${_UID:-1000}"
gid: "${_GID:-1000}"
volumes:
- ./trac:/var/lib/appdata
- ./trac/public_html:/trac/chrome
- ./trac/repos:/home/sources/git
working_dir: /var/lib/appdata
stdin_open: true
tty: true
hostname: trac.local
container_name: trac.local
ports:
- "${TRAC_PORT:-8000}:${TRAC_PORT:-8000}/tcp"
#command: /bin/bash
command: tracd --port ${TRAC_PORT:-8000} --auth="Tahoe-LAFS,./Tahoe-LAFS/conf/user_passwd,tahoe-lafs.org" ./Tahoe-LAFS
network_mode: "bridge"
# Prevents container to hang the host
# Requires `... --compatibility run ...`
deploy:
resources:
limits:
cpus: '1.5'
memory: 256M
gitea:
build:
context: docker/gitea
dockerfile: Dockerfile
volumes:
- ./gitea/conf:/etc/gitea
- ./gitea/data:/var/lib/gitea
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
working_dir: /var/lib/appdata
ports:
- "3000:3000"
- "2222:2222"
#command: /bin/bash
stdin_open: true
tty: true
hostname: gitea.local
container_name: gitea.local
network_mode: "bridge"
# Prevents container to hang the host
# Requires `... --compatibility run ...`
deploy:
resources:
limits:
cpus: '1.5'
memory: 256M

6
docker/gitea/Dockerfile Normal file
View File

@ -0,0 +1,6 @@
##############################
# General level requirements #
##############################
# Pull official base image from DockerHub
FROM gitea/gitea:1.21.7-rootless@sha256:5d433ef2ebae7eae7b0d0ec42263645a9d200d342fc31ea5bca9745611f89811

65
docker/trac/Dockerfile Normal file
View File

@ -0,0 +1,65 @@
##############################
# General level requirements #
##############################
# Pull official base image from DockerHub
FROM python:2.7.18-slim-buster@sha256:6c1ffdff499e29ea663e6e67c9b6b9a3b401d554d2c9f061f9a45344e3992363
# Avoid interactive frontend
ENV DEBIAN_FRONTEND="noninteractive"
##################################
# Application level requirements #
##################################
# Install required packages
RUN INSTALL_PKGS="git" && \
apt-get -q clean && \
apt-get -q update && \
apt-get install -y $INSTALL_PKGS && \
apt-get -q clean
###########################
# User level requirements #
###########################
# Parameters for default user:group
ARG uid=1000
ARG user=appuser
ARG gid=1000
ARG group=appgroup
# Add user and group for build and runtime
# So the output can be owned by the specified uid:gid
RUN grep -q ":${gid}:" /etc/group && { \
echo "Group ID ${gid} found"; \
} || { \
echo "Group ID ${gid} NOT found"; \
groupadd -g "${gid}" "${group}" && \
echo "Group ID ${gid} created"; \
}
RUN id "${uid}" > /dev/null 2>&1 && { \
echo "User ID ${uid} found"; \
} || { \
echo "User ID ${uid} NOT found"; \
useradd -md "/home/${user}" -s /bin/bash -g "${group}" -u "${uid}" "${user}" && \
echo "User ID ${uid} created"; \
}
# Switch to non-root user
USER ${user}
WORKDIR /home/${user}
# Prepare user variables
ENV USER ${user}
ENV HOME=/home/${user}
ENV PATH="${HOME}/.local/bin:${PATH}"
ENV PYTHONPATH="."
# Upgrade Pip
RUN python -m pip install --disable-pip-version-check --no-cache --upgrade "pip==20.3.4"
# Copy requirements
COPY requirements.txt /home/${user}/requirements.txt
# Install requirements
RUN python -m pip install --user --no-cache --upgrade -r requirements.txt

View File

@ -0,0 +1,13 @@
Babel==2.9.1
docutils==0.18.1
Genshi==0.7.7
html5lib==1.1
Pygments==2.5.2
pytz==2024.1
six==1.16.0
textile==3.0.4
Trac==1.0.13
TracAccountManager==0.6.0
TracHTTPAuth==1.2
TracXMLRPC==1.1.9
webencodings==0.5.1

0
gitea/.gitkeep Normal file
View File

0
trac/.gitkeep Normal file
View File