mirror of
https://github.com/casjaysdevdocker/cherokee
synced 2025-09-18 15:57:44 -04:00
🗃️ Committing everything that changed 🗃️
Some checks failed
release-tag / release-image (push) Failing after 13m37s
Some checks failed
release-tag / release-image (push) Failing after 13m37s
Dockerfile Dockerfile.cherokee Dockerfile.final Dockerfile.nossl Dockerfile.selective Dockerfile.stable Dockerfile.ubuntu Dockerfile.zevenet .env.scripts .gitignore rootfs/.gitea/workflows/docker.yaml rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/share/template-files/config/env/default.sample
This commit is contained in:
63
.env.scripts
63
.env.scripts
@@ -1,19 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202509160927-git
|
||||
##@Version : 202509161146-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : docker-admin@casjaysdev.pro
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@ReadME :
|
||||
# @@Copyright : Copyright (c) 2025 CasjaysDev
|
||||
# @@Created : Tue Sep 16 09:27:22 AM EDT 2025
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Tue Sep 16 11:46:49 AM EDT 2025
|
||||
# @@File : .env.scripts
|
||||
# @@Description : Variables for gen-dockerfile and buildx scripts
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set env variables
|
||||
# entrypoint Settings
|
||||
DOCKER_ENTYPOINT_PORTS_WEB="${DOCKER_ENTYPOINT_PORTS_WEB}"
|
||||
DOCKER_ENTYPOINT_PORTS_SRV="${DOCKER_ENTYPOINT_PORTS_SRV}"
|
||||
DOCKER_ENTYPOINT_HEALTH_APPS="$DOCKER_ENTYPOINT_HEALTH_APPS"
|
||||
DOCKER_ENTYPOINT_HEALTH_ENDPOINTS="$DOCKER_ENTYPOINT_HEALTH_ENDPOINTS"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Dockerfile info
|
||||
ENV_DOCKERFILE="Dockerfile"
|
||||
ENV_IMAGE_NAME="cherokee"
|
||||
ENV_IMAGE_TAG="latest"
|
||||
ENV_CONTAINER_VERSION="USE_DATE"
|
||||
ENV_USE_TEMPLATE="alpine"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Maintainer info
|
||||
ENV_ORG_NAME="casjaysdevdocker"
|
||||
ENV_VENDOR="CasjaysDev"
|
||||
ENV_AUTHOR="CasjaysDev"
|
||||
ENV_MAINTAINER="CasjaysDev <docker-admin@casjaysdev.pro>"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# REPO info
|
||||
ENV_GIT_REPO_URL="https://github.com/casjaysdevdocker/cherokee"
|
||||
ENV_REGISTRY_URL="docker.io"
|
||||
ENV_CONTAINER_NAME="casjaysdevdocker-cherokee"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Push image info
|
||||
ENV_IMAGE_PUSH="casjaysdevdocker/cherokee"
|
||||
ENV_IMAGE_TAG="latest"
|
||||
ENV_ADD_TAGS=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ENV_ADD_IMAGE_PUSH=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Pull image info
|
||||
ENV_PULL_URL="casjaysdev/alpine"
|
||||
ENV_DISTRO_TAG="${IMAGE_VERSION}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Env
|
||||
SERVICE_PORT=""
|
||||
EXPOSE_PORTS=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Versions
|
||||
PHP_VERSION="system"
|
||||
NODE_VERSION="system"
|
||||
NODE_MANAGER="system"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Default directories
|
||||
WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
||||
DEFAULT_FILE_DIR="/usr/local/share/template-files"
|
||||
DEFAULT_DATA_DIR="/usr/local/share/template-files/data"
|
||||
DEFAULT_CONF_DIR="/usr/local/share/template-files/config"
|
||||
DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ENV_PACKAGES=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
# gitignore created on 09/05/25 at 23:48
|
||||
# gitignore created on 09/16/25 at 11:46
|
||||
# Disable reminder in prompt
|
||||
ignoredirmessage
|
||||
|
||||
|
10
Dockerfile
10
Dockerfile
@@ -1,7 +1,7 @@
|
||||
# Docker image for cherokee using the alpine template
|
||||
ARG IMAGE_NAME="cherokee"
|
||||
ARG PHP_SERVER="cherokee"
|
||||
ARG BUILD_DATE="202509052348"
|
||||
ARG BUILD_DATE="202509161146"
|
||||
ARG LANGUAGE="en_US.UTF-8"
|
||||
ARG TIMEZONE="America/New_York"
|
||||
ARG WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
||||
@@ -20,7 +20,7 @@ ARG PHP_VERSION="system"
|
||||
ARG NODE_VERSION="system"
|
||||
ARG NODE_MANAGER="system"
|
||||
|
||||
ARG IMAGE_REPO="casjaysdevdocker/cherokee_temp"
|
||||
ARG IMAGE_REPO="casjaysdevdocker/cherokee"
|
||||
ARG IMAGE_VERSION="latest"
|
||||
ARG CONTAINER_VERSION=""
|
||||
|
||||
@@ -54,7 +54,7 @@ ARG PHP_SERVER
|
||||
ARG SHELL_OPTS
|
||||
ARG PATH
|
||||
|
||||
ARG PACK_LIST="cherokee cherokee-admin"
|
||||
ARG PACK_LIST=" "
|
||||
|
||||
ENV ENV=~/.profile
|
||||
ENV SHELL="/bin/sh"
|
||||
@@ -219,8 +219,8 @@ LABEL org.opencontainers.image.authors="${LICENSE}"
|
||||
LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
||||
LABEL org.opencontainers.image.version="${BUILD_VERSION}"
|
||||
LABEL org.opencontainers.image.schema-version="${BUILD_VERSION}"
|
||||
LABEL org.opencontainers.image.url="https://hub.docker.com/r/casjaysdevdocker/cherokee"
|
||||
LABEL org.opencontainers.image.source="https://hub.docker.com/r/casjaysdevdocker/cherokee"
|
||||
LABEL org.opencontainers.image.url="docker.io"
|
||||
LABEL org.opencontainers.image.source="docker.io"
|
||||
LABEL org.opencontainers.image.vcs-type="Git"
|
||||
LABEL org.opencontainers.image.revision="${BUILD_VERSION}"
|
||||
LABEL org.opencontainers.image.source="https://github.com/casjaysdevdocker/cherokee"
|
||||
|
@@ -1,75 +0,0 @@
|
||||
# Cherokee Web Server built from source
|
||||
FROM alpine:latest as builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
build-base \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
pkgconfig \
|
||||
git \
|
||||
gettext-dev \
|
||||
openssl-dev \
|
||||
pcre-dev \
|
||||
zlib-dev \
|
||||
python2
|
||||
|
||||
# Download and build Cherokee
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/cherokee/webserver.git cherokee && \
|
||||
cd cherokee && \
|
||||
./autogen.sh && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--enable-static-module=all \
|
||||
--disable-pam \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
openssl \
|
||||
pcre \
|
||||
zlib \
|
||||
gettext
|
||||
|
||||
# Copy Cherokee from builder
|
||||
COPY --from=builder /tmp/cherokee-install /
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee is running successfully!</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!ipv6 = 0
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,80 +0,0 @@
|
||||
# Cherokee Web Server from Zevenet fork - final working version
|
||||
FROM debian:bullseye as builder
|
||||
|
||||
# Install all build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool-bin \
|
||||
libtool \
|
||||
pkg-config \
|
||||
git \
|
||||
gettext \
|
||||
libssl-dev \
|
||||
libpcre3-dev \
|
||||
zlib1g-dev \
|
||||
python2 \
|
||||
python2-dev \
|
||||
autotools-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download Cherokee from Zevenet fork and prepare for build
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/zevenet/cherokee.git && \
|
||||
cd cherokee && \
|
||||
touch README ChangeLog AUTHORS NEWS && \
|
||||
./autogen.sh && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--disable-pam \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
openssl \
|
||||
pcre \
|
||||
zlib \
|
||||
gettext \
|
||||
libgcc \
|
||||
libstdc++
|
||||
|
||||
# Copy Cherokee from builder
|
||||
COPY --from=builder /tmp/cherokee-install /
|
||||
|
||||
# Create directories and fix permissions
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee && \
|
||||
chmod +x /usr/sbin/cherokee* /usr/bin/cherokee* 2>/dev/null || true
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee (Zevenet fork) is running successfully!</p><p>Built from: https://github.com/zevenet/cherokee</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,80 +0,0 @@
|
||||
# Cherokee Web Server from Zevenet fork - without SSL to avoid OpenSSL issues
|
||||
FROM debian:bullseye as builder
|
||||
|
||||
# Install build dependencies without SSL
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool-bin \
|
||||
libtool \
|
||||
pkg-config \
|
||||
git \
|
||||
gettext \
|
||||
libpcre3-dev \
|
||||
zlib1g-dev \
|
||||
python2 \
|
||||
python2-dev \
|
||||
autotools-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download Cherokee from Zevenet fork and build without SSL
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/zevenet/cherokee.git && \
|
||||
cd cherokee && \
|
||||
touch README ChangeLog AUTHORS NEWS && \
|
||||
./autogen.sh && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--disable-pam \
|
||||
--disable-tls \
|
||||
--without-ssl \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
pcre \
|
||||
zlib \
|
||||
gettext \
|
||||
libgcc \
|
||||
libstdc++
|
||||
|
||||
# Copy Cherokee from builder
|
||||
COPY --from=builder /tmp/cherokee-install/. /
|
||||
|
||||
# Create directories and fix permissions
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee && \
|
||||
chmod +x /usr/sbin/cherokee* /usr/bin/cherokee* 2>/dev/null || true
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee (Zevenet fork) is running successfully!</p><p>Built from: https://github.com/zevenet/cherokee</p><p><strong>Note:</strong> SSL disabled for compatibility</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,83 +0,0 @@
|
||||
# Cherokee Web Server from Zevenet fork - selective copy
|
||||
FROM debian:bullseye as builder
|
||||
|
||||
# Install build dependencies without SSL
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool-bin \
|
||||
libtool \
|
||||
pkg-config \
|
||||
git \
|
||||
gettext \
|
||||
libpcre3-dev \
|
||||
zlib1g-dev \
|
||||
python2 \
|
||||
python2-dev \
|
||||
autotools-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download Cherokee from Zevenet fork and build without SSL
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/zevenet/cherokee.git && \
|
||||
cd cherokee && \
|
||||
touch README ChangeLog AUTHORS NEWS && \
|
||||
./autogen.sh && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--disable-pam \
|
||||
--disable-tls \
|
||||
--without-ssl \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
pcre \
|
||||
pcre-dev \
|
||||
zlib \
|
||||
gettext \
|
||||
libgcc \
|
||||
libstdc++ \
|
||||
&& ln -sf /usr/lib/libpcre.so.1 /usr/lib/libpcre.so.3 || true
|
||||
|
||||
# Copy Cherokee binaries selectively
|
||||
COPY --from=builder /tmp/cherokee-install/usr /usr
|
||||
COPY --from=builder /tmp/cherokee-install/etc /etc
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee /var/run && \
|
||||
chmod +x /usr/sbin/cherokee* /usr/bin/cherokee* 2>/dev/null || true
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee (Zevenet fork) is running successfully!</p><p>Built from: https://github.com/zevenet/cherokee</p><p><strong>Note:</strong> SSL disabled for compatibility</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,77 +0,0 @@
|
||||
# Cherokee Web Server built from stable release
|
||||
FROM debian:bullseye as builder
|
||||
|
||||
# Install build dependencies including libtool
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
pkg-config \
|
||||
git \
|
||||
gettext \
|
||||
libssl-dev \
|
||||
libpcre3-dev \
|
||||
zlib1g-dev \
|
||||
python2 \
|
||||
python2-dev \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download and build Cherokee from stable release
|
||||
RUN cd /tmp && \
|
||||
wget http://cherokee-project.com/download/1.2/1.2.103/cherokee-1.2.103.tar.gz && \
|
||||
tar xzf cherokee-1.2.103.tar.gz && \
|
||||
cd cherokee-1.2.103 && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--disable-pam \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
openssl \
|
||||
pcre \
|
||||
zlib \
|
||||
gettext \
|
||||
libgcc \
|
||||
libstdc++
|
||||
|
||||
# Copy Cherokee from builder
|
||||
COPY --from=builder /tmp/cherokee-install /
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee v1.2.103 is running!</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,20 +0,0 @@
|
||||
# Try to install Cherokee from Ubuntu packages
|
||||
FROM ubuntu:20.04
|
||||
|
||||
# Install Cherokee from packages if available
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
cherokee \
|
||||
bash \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /var/www/html /config /data
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee is running from Ubuntu packages!</p>" > /var/www/html/index.html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["cherokee", "-p", "80"]
|
@@ -1,76 +0,0 @@
|
||||
# Cherokee Web Server from Zevenet fork
|
||||
FROM debian:bullseye as builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
pkg-config \
|
||||
git \
|
||||
gettext \
|
||||
libssl-dev \
|
||||
libpcre3-dev \
|
||||
zlib1g-dev \
|
||||
python2 \
|
||||
python2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download and build Cherokee from Zevenet fork
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/zevenet/cherokee.git && \
|
||||
cd cherokee && \
|
||||
./autogen.sh && \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc/cherokee \
|
||||
--localstatedir=/var \
|
||||
--disable-pam \
|
||||
--with-wwwroot=/var/www/html && \
|
||||
make && \
|
||||
make install DESTDIR=/tmp/cherokee-install
|
||||
|
||||
# Final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
openssl \
|
||||
pcre \
|
||||
zlib \
|
||||
gettext \
|
||||
libgcc \
|
||||
libstdc++
|
||||
|
||||
# Copy Cherokee from builder
|
||||
COPY --from=builder /tmp/cherokee-install /
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /var/www/html /config /data /var/log/cherokee
|
||||
|
||||
# Create a simple index page
|
||||
RUN echo "<h1>Cherokee Web Server</h1><p>Cherokee (Zevenet fork) is running successfully!</p>" > /var/www/html/index.html
|
||||
|
||||
# Create basic Cherokee config
|
||||
RUN mkdir -p /etc/cherokee && \
|
||||
cat > /etc/cherokee/cherokee.conf << 'EOF'
|
||||
server!port = 80
|
||||
server!server_tokens = off
|
||||
|
||||
vserver!1!nick = default
|
||||
vserver!1!document_root = /var/www/html
|
||||
vserver!1!directory_index = index.html,index.htm
|
||||
|
||||
vserver!1!rule!1!match = default
|
||||
vserver!1!rule!1!handler = file
|
||||
|
||||
mime!application/x-javascript!extensions = js
|
||||
mime!text/css!extensions = css
|
||||
mime!text/html!extensions = html,htm
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/sbin/cherokee", "-C", "/etc/cherokee/cherokee.conf"]
|
@@ -1,9 +1,9 @@
|
||||
name: cherokee_temp
|
||||
name: cherokee
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
release-cherokee_temp:
|
||||
release-cherokee:
|
||||
runs-on: act_runner
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202509052348-git
|
||||
##@Version : 202509161146-git
|
||||
# @@Author : Jason Hempstead
|
||||
# @@Contact : jason@casjaysdev.pro
|
||||
# @@License : WTFPL
|
||||
# @@License : LICENSE.md
|
||||
# @@ReadME : entrypoint.sh --help
|
||||
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
|
||||
# @@Created : Friday, Sep 05, 2025 23:48 EDT
|
||||
# @@Created : Tuesday, Sep 16, 2025 11:46 EDT
|
||||
# @@File : entrypoint.sh
|
||||
# @@Description : Entrypoint file for cherokee
|
||||
# @@Changelog : New script
|
||||
@@ -18,7 +18,7 @@
|
||||
# @@sudo/root : no
|
||||
# @@Template : other/docker-entrypoint
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
set -e
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -87,7 +87,7 @@ SERVICE_UID="${SERVICE_UID:-0}" # set the user id
|
||||
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
SERVICE_USER="${SERVICE_USER:-cherokee}" # execute command as another user
|
||||
SERVICE_USER="${SERVICE_USER:-$cherokee}" # execute command as another user
|
||||
SERVICE_GROUP="${SERVICE_GROUP:-cherokee}" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Secondary ports
|
||||
@@ -259,6 +259,8 @@ if [ -f "$ENTRYPOINT_PID_FILE" ]; then
|
||||
touch "$ENTRYPOINT_PID_FILE"
|
||||
else
|
||||
echo "$$" >"$ENTRYPOINT_PID_FILE"
|
||||
# Clean any stale PID files on first run
|
||||
rm -f /run/init.d/*.pid 2>/dev/null || true
|
||||
fi
|
||||
if [ -f "$ENTRYPOINT_INIT_FILE" ]; then
|
||||
ENTRYPOINT_MESSAGE="no" ENTRYPOINT_FIRST_RUN="no"
|
||||
@@ -370,8 +372,14 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
__setup_mta
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# if no pid assume container restart
|
||||
[ -f "$ENTRYPOINT_PID_FILE" ] && [ -f "/run/__start_init_scripts.pid" ] || START_SERVICES="yes"
|
||||
# if no pid assume container restart - clean stale files on restart
|
||||
if [ ! -f "$ENTRYPOINT_PID_FILE" ]; then
|
||||
START_SERVICES="yes"
|
||||
# Clean stale pid files from previous container runs
|
||||
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||
elif [ ! -f "/run/__start_init_scripts.pid" ]; then
|
||||
START_SERVICES="yes"
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "Container ip address is:" "$CONTAINER_IP4_ADDRESS"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@@ -18,7 +18,7 @@
|
||||
# @@sudo/root : no
|
||||
# @@Template : functions/docker-entrypoint
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
||||
@@ -39,59 +39,97 @@ __printf_space() {
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__rm() { [ -n "$1" ] && [ -e "$1" ] && rm -Rf "${1:?}"; }
|
||||
__grep_test() { grep -ash "$1" "$2" | grep -aqwF "${3:-$1}" || return 1; }
|
||||
__grep_test() { grep -sh "$1" "$2" | grep -qwF "${3:-$1}" || return 1; }
|
||||
__netstat() { [ -f "$(type -P netstat)" ] && netstat "$@" || return 10; }
|
||||
__cd() { { [ -d "$1" ] || mkdir -p "$1"; } && builtin cd "$1" || return 1; }
|
||||
__is_in_file() { [ -e "$2" ] && grep -Rsaq "$1" "$2" && return 0 || return 1; }
|
||||
__is_in_file() { [ -e "$2" ] && grep -Rsq "$1" "$2" && return 0 || return 1; }
|
||||
__curl() { curl -q -sfI --max-time 3 -k -o /dev/null "$@" &>/dev/null || return 10; }
|
||||
__find() { find "$1" -mindepth 1 -type ${2:-f,d} 2>/dev/null | grep -a '^' || return 10; }
|
||||
__find() { find "$1" -mindepth 1 -type ${2:-f,d} 2>/dev/null | grep '.' || return 10; }
|
||||
__pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -o "$1$" &>/dev/null || return 10; }
|
||||
__file_exists_with_content() { [ -n "$1" ] && [ -f "$1" ] && [ -s "$1" ] && return 0 || return 2; }
|
||||
__sed() { sed -i 's|'$1'|'$2'|g' "$3" &>/dev/null || sed -i "s|$1|$2|g" "$3" &>/dev/null || return 1; }
|
||||
__pgrep() { __pcheck "${1:-SERVICE_NAME}" || __ps "${1:-$SERVICE_NAME}" | grep -aqv ' grep' || return 10; }
|
||||
__ps() { [ -f "$(type -P ps)" ] && ps "$@" 2>/dev/null | sed 's|:||g' | grep -aFw " ${1:-$SERVICE_NAME}$" || return 10; }
|
||||
__pgrep() { __pcheck "${1:-SERVICE_NAME}" || __ps "${1:-$SERVICE_NAME}" | grep -qv ' grep' || return 10; }
|
||||
__ps() { [ -f "$(type -P ps)" ] && ps "$@" 2>/dev/null | sed 's|:||g' | grep -Fw " ${1:-$SERVICE_NAME}$" || return 10; }
|
||||
__is_dir_empty() { if [ -n "$1" ]; then [ "$(ls -A "$1" 2>/dev/null | wc -l)" -eq 0 ] && return 0 || return 1; else return 1; fi; }
|
||||
__get_ip6() { ip a 2>/dev/null | grep -aw 'inet6' | awk '{print $2}' | grep -avE '^::1|^fe' | sed 's|/.*||g' | head -n1 | grep -a '^' || echo ''; }
|
||||
__get_ip4() { ip a 2>/dev/null | grep -aw 'inet' | awk '{print $2}' | grep -avE '^127.0.0' | sed 's|/.*||g' | head -n1 | grep -a '^' || echo '127.0.0.1'; }
|
||||
__find_file_relative() { find "$1"/* -not -path '*env/*' -not -path '.git*' -type f 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -av '^$' | grep -a '^' || false; }
|
||||
__find_directory_relative() { find "$1"/* -not -path '*env/*' -not -path '.git*' -type d 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -av '^$' | grep -a '^' || false; }
|
||||
__get_ip6() { ip a 2>/dev/null | grep -w 'inet6' | awk '{print $2}' | grep -vE '^::1|^fe' | sed 's|/.*||g' | head -n1 | grep '.' || echo ''; }
|
||||
__get_ip4() { ip a 2>/dev/null | grep -w 'inet' | awk '{print $2}' | grep -vE '^127.0.0' | sed 's|/.*||g' | head -n1 | grep '.' || echo '127.0.0.1'; }
|
||||
__find_file_relative() { find "$1"/* -not -path '*env/*' -not -path '.git*' -type f 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -v '^$' | grep '.' || false; }
|
||||
__find_directory_relative() { find "$1"/* -not -path '*env/*' -not -path '.git*' -type d 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -v '^$' | grep '.' || false; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__pid_exists() { ps -ax --no-header | sed 's/^[[:space:]]*//g' | awk -F' ' '{print $1}' | sed 's|:||g' | grep -a '[0-9]' | sort -uV | grep -a "^$1$" && return 0 || return 1; }
|
||||
__is_running() { ps -eo args --no-header | awk '{print $1,$2,$3}' | sed 's|:||g' | sort -u | grep -avE 'grep|COMMAND|awk|tee|ps|sed|sort|tail' | grep "$1" | grep -aq "${2:-^}" && return 0 || return 1; }
|
||||
__get_pid() { ps -ax --no-header | sed 's/^[[:space:]]*//g;s|;||g;s|:||g' | awk '{print $1,$5}' | sed 's|:||g' | grep "$1$" | grep -av 'grep' | awk -F' ' '{print $1}' | grep -a '[0-9]' | sort -uV | head -n1 | grep -a '^' && return 0 || return 1; }
|
||||
__pid_exists() { ps -ax --no-header | sed 's/^[[:space:]]*//g' | awk -F' ' '{print $1}' | sed 's|:||g' | grep '[0-9]' | sort -uV | grep "^$1$" && return 0 || return 1; }
|
||||
__is_running() { ps -eo args --no-header | awk '{print $1,$2,$3}' | sed 's|:||g' | sort -u | grep -vE 'grep|COMMAND|awk|tee|ps|sed|sort|tail' | grep "$1" | grep -q "${2:-^}" && return 0 || return 1; }
|
||||
__get_pid() { ps -ax --no-header | sed 's/^[[:space:]]*//g;s|;||g;s|:||g' | awk '{print $1,$5}' | sed 's|:||g' | grep "$1$" | grep -v 'grep' | awk -F' ' '{print $1}' | grep '[0-9]' | sort -uV | head -n1 | grep '.' && return 0 || return 1; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__format_variables() { printf '%s\n' "${@//,/ }" | tr ' ' '\n' | sort -RVu | grep -av '^$' | tr '\n' ' ' | __clean_variables | grep -a '^' || return 3; }
|
||||
__format_variables() { printf '%s\n' "${@//,/ }" | tr ' ' '\n' | sort -RVu | grep -v '^$' | tr '\n' ' ' | __clean_variables | grep '.' || return 3; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__clean_variables() {
|
||||
local var="$*"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
var="$(printf '%s\n' "$var" | sed 's/\( \)*/\1/g;s|^ ||g')"
|
||||
printf '%s' "$var" | grep -av '^$'
|
||||
printf '%s' "$var" | grep -v '^$'
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__no_exit() { [ -f "/run/no_exit.pid" ] || exec bash -c "trap 'sleep 1;rm -Rf /run/*;/tmp/*;/data/logs/start.log;exit 0' TERM INT;(while true; do echo $$ >/run/no_exit.pid;tail -qf /data/logs/start.log 2>/dev/null||sleep 20; done) & wait"; }
|
||||
__no_exit() {
|
||||
local monitor_interval="${SERVICE_MONITOR_INTERVAL:-60}"
|
||||
local failure_threshold="${SERVICE_FAILURE_THRESHOLD:-3}"
|
||||
local monitor_services="${SERVICES_LIST:-tini}"
|
||||
local failed_services=""
|
||||
local failure_count=0
|
||||
|
||||
[ -f "/run/no_exit.pid" ] && return 0
|
||||
|
||||
exec bash -c "
|
||||
trap 'echo \"Container shutdown requested\"; rm -f /run/no_exit.pid /run/*.pid; exit 0' TERM INT
|
||||
echo \$\$ > /run/no_exit.pid
|
||||
|
||||
while true; do
|
||||
if [ -n \"$monitor_services\" ] && [ \"$monitor_services\" != \"tini\" ]; then
|
||||
for service in \$(echo \"$monitor_services\" | tr ',' ' '); do
|
||||
if [ \"\$service\" != \"tini\" ] && ! pgrep -x \"\$service\" >/dev/null 2>&1; then
|
||||
echo \"⚠️ Service \$service is not running\" >&2
|
||||
failed_services=\"\$failed_services \$service\"
|
||||
failure_count=\$((failure_count + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ \$failure_count -ge $failure_threshold ]; then
|
||||
echo \"❌ Too many service failures (\$failure_count), exiting container\" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n \"\$failed_services\" ]; then
|
||||
echo \"⚠️ Failed services:\$failed_services\" >&2
|
||||
failed_services=\"\"
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep $monitor_interval
|
||||
done &
|
||||
wait
|
||||
"
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__trim() {
|
||||
local var="${*//;/ }"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
var="$(echo "$var" | __remove_extra_spaces | sed "s| |; |g;s|;$| |g" | __remove_extra_spaces)"
|
||||
printf '%s' "$var" | sed 's|;||g' | grep -av '^$'
|
||||
printf '%s' "$var" | sed 's|;||g' | grep -v '^$'
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__banner() { printf '# - - - %-60s - - - #\n' "$*"; }
|
||||
__find_php_bin() { find -L '/usr'/*bin -maxdepth 4 -name 'php-fpm*' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_php_ini() { find -L '/etc' -maxdepth 4 -name 'php.ini' 2>/dev/null | head -n1 | sed 's|/php.ini||g' | grep -a '^' || echo ''; }
|
||||
__find_php_bin() { find -L '/usr'/*bin -maxdepth 4 -name 'php-fpm*' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_php_ini() { find -L '/etc' -maxdepth 4 -name 'php.ini' 2>/dev/null | head -n1 | sed 's|/php.ini||g' | grep '.' || echo ''; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__find_nginx_conf() { find -L '/etc' -maxdepth 4 -name 'nginx.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_caddy_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'caddy.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_lighttpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'lighttpd.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_cherokee_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'cherokee.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_httpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'httpd.conf' -o -iname 'apache2.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_nginx_conf() { find -L '/etc' -maxdepth 4 -name 'nginx.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_caddy_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'caddy.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_lighttpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'lighttpd.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_cherokee_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'cherokee.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_httpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'httpd.conf' -o -iname 'apache2.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__find_mysql_conf() { find -L '/etc' -maxdepth 4 -type f -name 'my.cnf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_pgsql_conf() { find -L '/var/lib' '/etc' -maxdepth 8 -type f -name 'postgresql.conf' 2>/dev/null | head -n1 | grep -a '^' || echo ''; }
|
||||
__find_mysql_conf() { find -L '/etc' -maxdepth 4 -type f -name 'my.cnf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_pgsql_conf() { find -L '/var/lib' '/etc' -maxdepth 8 -type f -name 'postgresql.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; }
|
||||
__find_couchdb_conf() { return; }
|
||||
__find_mongodb_conf() { return; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -422,7 +460,7 @@ __file_copy() {
|
||||
__generate_random_uids() {
|
||||
local set_random_uid="$(seq 3000 5000 | sort -R | head -n 1)"
|
||||
while :; do
|
||||
if grep -ashq "x:.*:$set_random_uid:" "/etc/group" && ! grep -ashq "x:$set_random_uid:.*:" "/etc/passwd"; then
|
||||
if grep -shq "x:.*:$set_random_uid:" "/etc/group" && ! grep -shq "x:$set_random_uid:.*:" "/etc/passwd"; then
|
||||
set_random_uid=$((set_random_uid + 1))
|
||||
else
|
||||
echo "$set_random_uid"
|
||||
@@ -470,7 +508,7 @@ __fix_permissions() {
|
||||
change_group="${2:-${SERVICE_GROUP:-$change_user}}"
|
||||
[ -n "$RUNAS_USER" ] && [ "$RUNAS_USER" != "root" ] && change_user="$RUNAS_USER" && change_group="$change_user"
|
||||
if [ -n "$change_user" ]; then
|
||||
if grep -ashq "^$change_user:" "/etc/passwd"; then
|
||||
if grep -shq "^$change_user:" "/etc/passwd"; then
|
||||
for permissions in $ADD_APPLICATION_DIRS $APPLICATION_DIRS; do
|
||||
if [ -n "$permissions" ] && [ -e "$permissions" ]; then
|
||||
(chown -Rf $change_user "$permissions" && echo "changed ownership on $permissions to user:$change_user") 2>/dev/stderr | tee -p -a "/data/logs/init.txt"
|
||||
@@ -479,7 +517,7 @@ __fix_permissions() {
|
||||
fi
|
||||
fi
|
||||
if [ -n "$change_group" ]; then
|
||||
if grep -ashq "^$change_group:" "/etc/group"; then
|
||||
if grep -shq "^$change_group:" "/etc/group"; then
|
||||
for permissions in $ADD_APPLICATION_DIRS $APPLICATION_DIRS; do
|
||||
if [ -n "$permissions" ] && [ -e "$permissions" ]; then
|
||||
(chgrp -Rf $change_group "$permissions" && echo "changed group ownership on $permissions to group $change_group") 2>/dev/stderr | tee -p -a "/data/logs/init.txt"
|
||||
@@ -489,12 +527,12 @@ __fix_permissions() {
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__get_gid() { grep -a "^$1:" /etc/group | awk -F ':' '{print $3}' || false; }
|
||||
__get_uid() { grep -a "^$1:" /etc/passwd | awk -F ':' '{print $3}' || false; }
|
||||
__check_for_uid() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -aq "^$1$" || false; }
|
||||
__check_for_guid() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -aq "^$1$" || false; }
|
||||
__check_for_user() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -aq "^$1$" || false; }
|
||||
__check_for_group() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -aq "^$1$" || false; }
|
||||
__get_gid() { grep "^$1:" /etc/group | awk -F ':' '{print $3}' || false; }
|
||||
__get_uid() { grep "^$1:" /etc/passwd | awk -F ':' '{print $3}' || false; }
|
||||
__check_for_uid() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -q "^$1$" || false; }
|
||||
__check_for_guid() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -q "^$1$" || false; }
|
||||
__check_for_user() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -q "^$1$" || false; }
|
||||
__check_for_group() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -q "^$1$" || false; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# check if process is already running
|
||||
__proc_check() {
|
||||
@@ -519,9 +557,9 @@ __set_user_group_id() {
|
||||
local random_id="$(__generate_random_uids)"
|
||||
set_uid="$(__get_uid "$set_user" || echo "$set_uid")"
|
||||
set_gid="$(__get_gid "$set_user" || echo "$set_gid")"
|
||||
grep -ashq "^$create_user:" "/etc/passwd" "/etc/group" || return 0
|
||||
grep -shq "^$create_user:" "/etc/passwd" "/etc/group" || return 0
|
||||
[ -n "$set_user" ] && [ "$set_user" != "root" ] || return
|
||||
if grep -ashq "^$set_user:" "/etc/passwd" "/etc/group"; then
|
||||
if grep -shq "^$set_user:" "/etc/passwd" "/etc/group"; then
|
||||
if __check_for_guid "$set_gid"; then
|
||||
groupmod -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null && chown -Rf ":$set_gid"
|
||||
fi
|
||||
@@ -542,7 +580,7 @@ __create_service_user() {
|
||||
local create_gid="${5:-${SERVICE_GID:-$USER_GID}}"
|
||||
local random_id="$(__generate_random_uids)"
|
||||
local create_home_dir="${create_home_dir:-/home/$create_user}"
|
||||
grep -ashq "^$create_user:" "/etc/passwd" && grep -ashq "^$create_group:" "/etc/group" && return
|
||||
grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group" && return
|
||||
[ "$create_user" = "root" ] && [ "$create_group" = "root" ] && return 0
|
||||
if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then
|
||||
create_user="$RUNAS_USER"
|
||||
@@ -570,8 +608,8 @@ __create_service_user() {
|
||||
echo "creating system user $create_user"
|
||||
useradd --system -u $create_uid -g $create_group -c "Account for $create_user" -d "$create_home_dir" -s /bin/false $create_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null
|
||||
fi
|
||||
grep -ashq "$create_group" "/etc/group" || exitStatus=$((exitCode + 1))
|
||||
grep -ashq "$create_user" "/etc/passwd" || exitStatus=$((exitCode + 1))
|
||||
grep -shq "$create_group" "/etc/group" || exitStatus=$((exitCode + 1))
|
||||
grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitCode + 1))
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
export WORK_DIR="${create_home_dir:-}"
|
||||
if [ -n "$WORK_DIR" ]; then
|
||||
@@ -580,7 +618,7 @@ __create_service_user() {
|
||||
fi
|
||||
if [ -d "/etc/sudoers.d" ] && [ ! -f "/etc/sudoers.d/$create_user" ]; then
|
||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/$create_user"
|
||||
elif [ -f "/etc/sudoers" ] && grep -aqs "$create_user" "/etc/sudoers"; then
|
||||
elif [ -f "/etc/sudoers" ] && grep -qs "$create_user" "/etc/sudoers"; then
|
||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers"
|
||||
fi
|
||||
export SERVICE_UID="$create_uid"
|
||||
@@ -624,7 +662,7 @@ __exec_command() {
|
||||
local cmdExec="${arg:-}"
|
||||
local pre_exec="--login -c"
|
||||
local shell="$(type -P bash 2>/dev/null || type -P dash 2>/dev/null || type -P ash 2>/dev/null || type -P sh 2>/dev/null)"
|
||||
bin="$(echo "${arg[*]}" | tr ' ' '\n' | grep -av '^$' | head -n1 | sed 's| ||g' || echo 'bash')"
|
||||
bin="$(echo "${arg[*]}" | tr ' ' '\n' | grep -v '^$' | head -n1 | sed 's| ||g' || echo 'bash')"
|
||||
prog="$(type -P "$bin" 2>/dev/null || echo "$bin")"
|
||||
if type -t $bin >/dev/null 2>&1; then
|
||||
echo "${exec_message:-Executing command: $cmdExec}"
|
||||
@@ -652,15 +690,26 @@ __start_init_scripts() {
|
||||
local retstatus="0"
|
||||
local initStatus="0"
|
||||
local init_dir="${1:-/usr/local/etc/docker/init.d}"
|
||||
local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -av '\.sample' | wc -l)"
|
||||
local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -v '\.sample' | wc -l)"
|
||||
local critical_failures=0
|
||||
local exit_on_failure="${EXIT_ON_SERVICE_FAILURE:-true}"
|
||||
|
||||
if [ -n "$SERVICE_DISABLED" ]; then
|
||||
unset SERVICE_DISABLED
|
||||
echo "$SERVICE_DISABLED is disabled"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Clean stale PID files from previous runs
|
||||
if [ ! -f "/run/__start_init_scripts.pid" ]; then
|
||||
echo "🧹 Cleaning stale PID files from previous container run"
|
||||
rm -f /run/*.pid /run/init.d/*.pid 2>/dev/null || true
|
||||
fi
|
||||
|
||||
touch /run/__start_init_scripts.pid
|
||||
mkdir -p "/tmp" "/run" "/run/init.d" "/usr/local/etc/docker/exec"
|
||||
chmod -R 777 "/tmp" "/run" "/run/init.d" "/usr/local/etc/docker/exec"
|
||||
|
||||
if [ "$init_count" -eq 0 ] || [ ! -d "$init_dir" ]; then
|
||||
mkdir -p "/data/logs/init"
|
||||
while :; do echo "Running: $(date)" >"/data/logs/init/keep_alive" && sleep 3600; done &
|
||||
@@ -668,26 +717,56 @@ __start_init_scripts() {
|
||||
if [ -d "$init_dir" ]; then
|
||||
[ -f "$init_dir/service.sample" ] && __rm "$init_dir"/*.sample
|
||||
chmod -Rf 755 "$init_dir"/*.sh
|
||||
|
||||
echo "🚀 Starting container services initialization"
|
||||
echo "📂 Init directory: $init_dir"
|
||||
echo "📊 Services to start: $init_count"
|
||||
echo "📋 Found $init_count service scripts to execute"
|
||||
echo ""
|
||||
|
||||
for init in "$init_dir"/*.sh; do
|
||||
if [ -x "$init" ]; then
|
||||
name="$(basename "$init")"
|
||||
service="$(printf '%s' "$name" | sed 's/^[^-]*-//;s|.sh$||g')"
|
||||
printf '# - - - executing file: %s\n' "$init"
|
||||
eval "$init" && sleep 5 || sleep 3
|
||||
|
||||
echo "🔧 Executing service script: $init (service: $service)"
|
||||
|
||||
# Execute the init script and capture the exit code
|
||||
if eval "$init"; then
|
||||
sleep 5
|
||||
retPID=$(__get_pid "$service")
|
||||
if [ -n "$retPID" ]; then
|
||||
initStatus="0"
|
||||
printf '# - - - %s has been started - pid: %s\n' "$service" "${retPID:-error}"
|
||||
echo "✅ Service $service started successfully - PID: ${retPID}"
|
||||
else
|
||||
initStatus="1"
|
||||
printf '# - - - %s has failed to start - check log %s\n' "$service" "docker log $CONTAINER_NAME"
|
||||
critical_failures=$((critical_failures + 1))
|
||||
echo "⚠️ Service $service appears to have started but no process found"
|
||||
fi
|
||||
else
|
||||
initStatus="1"
|
||||
critical_failures=$((critical_failures + 1))
|
||||
echo "❌ Service $service failed to start - check logs: docker logs $CONTAINER_NAME"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
fi
|
||||
retstatus=$(($retstatus + $initStatus))
|
||||
retstatus=$((retstatus + initStatus))
|
||||
done
|
||||
|
||||
# Summary
|
||||
if [ $critical_failures -gt 0 ]; then
|
||||
echo "⚠️ Warning: $critical_failures service(s) failed to start"
|
||||
if [ "$exit_on_failure" = "true" ] && [ $critical_failures -ge 1 ]; then
|
||||
echo "❌ Exiting due to critical service failures"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "✅ All services started successfully"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
printf '%s\n' "$SERVICE_NAME started on $(date)" >"/data/logs/start.log"
|
||||
return $retstatus
|
||||
}
|
||||
@@ -703,7 +782,7 @@ __setup_mta() {
|
||||
local local_hostname="${FULL_DOMAIN_NAME:-}"
|
||||
local account_user="${SERVER_ADMIN//@*/}"
|
||||
local account_domain="${EMAIL_DOMAIN//*@/}"
|
||||
echo "$EMAIL_RELAY" | grep -a '[0-9][0-9]' || relay_port="465"
|
||||
echo "$EMAIL_RELAY" | grep '[0-9][0-9]' || relay_port="465"
|
||||
################# sSMTP relay setup
|
||||
if [ -n "$(type -P 'ssmtp')" ]; then
|
||||
[ -d "/config/ssmtp" ] || mkdir -p "/config/ssmtp"
|
||||
@@ -868,7 +947,7 @@ __initialize_database() {
|
||||
__find_replace "REPLACE_DATABASE_ROOT_PASS" "$db_admin_pass" "$dir"
|
||||
__find_replace "REPLACE_DATABASE_NAME" "$DATABASE_NAME" "$dir"
|
||||
__find_replace "REPLACE_DATABASE_DIR" "$DATABASE_DIR" "$dir"
|
||||
if echo "$dir" | grep -aq '^/etc'; then
|
||||
if echo "$dir" | grep -q '^/etc'; then
|
||||
__find_replace "REPLACE_USER_NAME" "$db_normal_user" "/etc"
|
||||
__find_replace "REPLACE_USER_PASS" "$db_normal_pass" "/etc"
|
||||
__find_replace "REPLACE_DATABASE_USER" "$db_normal_user" "/etc"
|
||||
@@ -901,8 +980,8 @@ __initialize_system_etc() {
|
||||
local file=()
|
||||
local directories=""
|
||||
if [ -n "$conf_dir" ] && [ -e "$conf_dir" ]; then
|
||||
files="$(find "$conf_dir"/* -not -path '*/env/*' -type f 2>/dev/null | sed 's|'/config/'||g' | sort -u | grep -av '^$' | grep -a '^' || false)"
|
||||
directories="$(find "$conf_dir"/* -not -path '*/env/*' -type d 2>/dev/null | sed 's|'/config/'||g' | sort -u | grep -av '^$' | grep -a '^' || false)"
|
||||
files="$(find "$conf_dir"/* -not -path '*/env/*' -type f 2>/dev/null | sed 's|'/config/'||g' | sort -u | grep -v '^$' | grep '.' || false)"
|
||||
directories="$(find "$conf_dir"/* -not -path '*/env/*' -type d 2>/dev/null | sed 's|'/config/'||g' | sort -u | grep -v '^$' | grep '.' || false)"
|
||||
echo "Copying config files to system: $conf_dir > /etc/${conf_dir//\/config\//}"
|
||||
if [ -n "$directories" ]; then
|
||||
for d in $directories; do
|
||||
@@ -1016,7 +1095,7 @@ __initialize_www_root() {
|
||||
__is_htdocs_mounted() {
|
||||
WWW_ROOT_DIR="${WWW_ROOT_DIR:-/data/htdocs}"
|
||||
[ -n "$ENV_WWW_ROOT_DIR" ] && WWW_ROOT_DIR="$ENV_WWW_ROOT_DIR"
|
||||
[ -n "$IMPORT_FROM_GIT" ] && echo "$IMPORT_FROM_GIT" | grep -aqE 'https://|http://|git://|ssh://' || unset IMPORT_FROM_GIT
|
||||
[ -n "$IMPORT_FROM_GIT" ] && echo "$IMPORT_FROM_GIT" | grep -qE 'https://|http://|git://|ssh://' || unset IMPORT_FROM_GIT
|
||||
if [ -n "$IMPORT_FROM_GIT" ] && [ "$(command -v "git" 2>/dev/null)" ]; then
|
||||
if __is_dir_empty "$WWW_ROOT_DIR"; then
|
||||
echo "Importing project from $IMPORT_FROM_GIT to $WWW_ROOT_DIR"
|
||||
@@ -1073,7 +1152,7 @@ __start_php_dev_server() {
|
||||
find "/usr/local/share/httpd" -type f -not -path '.git*' -iname '*.php' -exec sed -i 's|[<].*SERVER_ADDR.*[>]|'${CONTAINER_IP4_ADDRESS:-127.0.0.1}'|g' {} \; 2>/dev/null
|
||||
php -S 0.0.0.0:$PHP_DEV_SERVER_PORT -t "/usr/local/share/httpd"
|
||||
fi
|
||||
if ! echo "$1" | grep -aq "^/usr/local/share/httpd"; then
|
||||
if ! echo "$1" | grep -q "^/usr/local/share/httpd"; then
|
||||
find "$1" -type f -not -path '.git*' -iname '*.php' -exec sed -i 's|[<].*SERVER_ADDR.*[>]|'${CONTAINER_IP4_ADDRESS:-127.0.0.1}'|g' {} \; 2>/dev/null
|
||||
php -S 0.0.0.0:$PHP_DEV_SERVER_PORT -t "$1"
|
||||
fi
|
||||
|
@@ -113,7 +113,7 @@ DATABASE_DIR_COUCHDB="${DATABASE_DIR_COUCHDB:-$DATABASE_BASE_DIR/couchdb}"
|
||||
DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-$DATABASE_BASE_DIR/supabase}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# docker env
|
||||
DOCKER_HOST="unix://var/run/docker.sock"
|
||||
DOCKER_HOST="unix:///run/docker.sock"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# File locations
|
||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}"
|
||||
|
Reference in New Issue
Block a user