🦈🏠🐜 Initial Commit 🐜🦈🏠

This commit is contained in:
casjay 2022-10-13 15:15:10 -04:00
commit 67543a43ae
No known key found for this signature in database
GPG Key ID: 4F765975C1F0EE5F
9 changed files with 404 additions and 0 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
# Files to ignore
.gitkeep
.gitignore
.node_modules/**

93
.gitignore vendored Normal file
View File

@ -0,0 +1,93 @@
# gitignore created on 10/13/22 at 15:15
# Disable reminder in prompt
ignoredirmessage
# OS generated files
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Other
**/.installed
# ignore commit message
**/.gitcommit
#ignore .failed
**/.build_failed
# ignore .bak files
**/*.bak
# ignore .no_push files
**/.no_push
# ignore .no_git files
**/.no_git

72
Dockerfile Normal file
View File

@ -0,0 +1,72 @@
FROM casjaysdevdocker/alpine:latest AS build
ARG alpine_version="edge"
ARG TIMEZONE="America/New_York" \
IMAGE_NAME="podman" \
LICENSE="MIT" \
PORTS=""
ENV TZ="$TIMEZONE" \
SHELL="/bin/bash" \
TERM="xterm-256color" \
HOSTNAME="${HOSTNAME:-casjaysdev-$IMAGE_NAME}"
RUN set -ex; \
rm -Rf "/etc/apk/repositories"; \
echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/main" >> "/etc/apk/repositories"; \
echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/community" >> "/etc/apk/repositories"; \
if [ "$alpine_version" = "edge" ]; then echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/testing" >> "/etc/apk/repositories" ; fi ; \
apk update --update-cache && apk add \
podman \
podman-docker \
podman-tui
COPY ./bin/. /usr/local/bin/
COPY ./data/. /usr/local/share/template-files/data/
COPY ./config/. /usr/local/share/template-files/config/
RUN rm -Rf /bin/.gitkeep /usr/local/bin/.gitkeep /config /data /var/cache/apk/*
FROM scratch
ARG BUILD_DATE="2022-10-13" \
BUILD_VERSION="latest"
LABEL maintainer="CasjaysDev <docker-admin@casjaysdev.com>" \
org.opencontainers.image.vcs-type="Git" \
org.opencontainers.image.name="podman" \
org.opencontainers.image.base.name="podman" \
org.opencontainers.image.license="$LICENSE" \
org.opencontainers.image.vcs-ref="$BUILD_VERSION" \
org.opencontainers.image.build-date="$BUILD_DATE" \
org.opencontainers.image.version="$BUILD_VERSION" \
org.opencontainers.image.schema-version="$BUILD_VERSION" \
org.opencontainers.image.url="https://hub.docker.com/r/casjaysdevdocker/podman" \
org.opencontainers.image.vcs-url="https://github.com/casjaysdevdocker/podman" \
org.opencontainers.image.url.source="https://github.com/casjaysdevdocker/podman" \
org.opencontainers.image.documentation="https://hub.docker.com/r/casjaysdevdocker/podman" \
org.opencontainers.image.vendor="CasjaysDev" \
org.opencontainers.image.authors="CasjaysDev" \
org.opencontainers.image.description="Containerized version of podman"
ENV SHELL="/bin/bash" \
TERM="xterm-256color" \
HOSTNAME="casjaysdev-podman" \
TZ="${TZ:-America/New_York}" \
TIMEZONE="$$TIMEZONE" \
PHP_SERVER="none" \
PORT="" \
DISPLAY=${DISPLAY}
COPY --from=build /. /
WORKDIR /root
VOLUME [ "/config","/data" ]
EXPOSE $PORTS
ENTRYPOINT [ "tini", "-p", "SIGTERM", "--" ]
CMD [ "/usr/local/bin/entrypoint-podman.sh" ]
HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-podman.sh", "healthcheck" ]

13
LICENSE.md Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2022 casjay <git-admin@casjaysdev.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1. You just DO WHAT THE FUCK YOU WANT TO.

36
README.md Normal file
View File

@ -0,0 +1,36 @@
## 👋 Welcome to podman 🚀
podman README
## Install my system scripts
```shell
sudo bash -c "$(curl -q -LSsf "https://github.com/systemmgr/installer/raw/main/install.sh")"
sudo systemmgr --config && sudo systemmgr install scripts
```
## Get source files
```shell
dockermgr download src podman
```
OR
```shell
git clone "https://github.com/casjaysdevdocker/podman" "$HOME/Projects/github/casjaysdevdocker/podman"
```
## Build container
```shell
cd "$HOME/Projects/github/casjaysdevdocker/podman"
buildx
```
## Authors
🤖 casjay: [Github](https://github.com/casjay) [Docker](https://hub.docker.com/r/casjay) 🤖
📽 dockermgr: [Github](https://github.com/dockermgr) [Docker](https://hub.docker.com/r/dockermgr) 📽
⛵ CasjaysDev Docker: [Github](https://github.com/casjaysdevdocker) [Docker](https://hub.docker.com/r/casjaysdevdocker) ⛵

0
bin/.gitkeep Normal file
View File

186
bin/entrypoint-podman.sh Executable file
View File

@ -0,0 +1,186 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202210131502-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.com
# @@License : WTFPL
# @@ReadME : entrypoint-podman.sh --help
# @@Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
# @@Created : Thursday, Oct 13, 2022 15:02 EDT
# @@File : entrypoint-podman.sh
# @@Description :
# @@Changelog : New script
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : other/docker-entrypoint
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options
[ -n "$DEBUG" ] && set -x
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename "$0" 2>/dev/null)"
VERSION="202210131502-git"
HOME="${USER_HOME:-$HOME}"
USER="${SUDO_USER:-$USER}"
RUN_USER="${SUDO_USER:-$USER}"
SCRIPT_SRC_DIR="${BASH_SOURCE%/*}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set functions
__find() { find "$1" -mindepth 1 -type f,d 2>/dev/null | grep '^' || return 10; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__start_shell() {
local l="$(which zsh || which bash || which sh || echo 'false')"
echo "$shell"
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__exec_command() {
local exitCode=0
local cmd="${*:-$(__start_shell) -l}"
echo "Executing command: $cmd"
eval $cmd || exitCode=10
[ "$exitCode" = 0 ] || exitCode=10
return ${exitCode:-$?}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Functions
__heath_check() {
local status=0
#curl -q -LSsf -o /dev/null -s -w "200" "http://localhost/server-health" || status=$(($status + 1))
echo "$(uname -s) $(uname -m) is running"
return ${status:-$?}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define default variables - do not change these - redifine with -e or set under Additional
LANG="${LANG:-C.UTF-8}"
TZ="${TZ:-America/New_York}"
DOMANNAME="${DOMANNAME:-}"
HOSTNAME="${HOSTNAME:-casjaysdev-bin}"
HOSTADMIN="${HOSTADMIN:-root@${DOMANNAME:-$HOSTNAME}}"
SSL_ENABLED="${SSL_ENABLED:-false}"
SSL_DIR="${SSL_DIR:-/config/ssl}"
SSL_CA="${SSL_CA:-$SSL_DIR/ca.crt}"
SSL_KEY="${SSL_KEY:-$SSL_DIR/server.key}"
SSL_CERT="${SSL_CERT:-$SSL_DIR/server.crt}"
HTTP_PORT="${HTTP_PORT:-80}"
HTTPS_PORT="${HTTPS_PORT:-443}"
SERVICE_PORT="${SERVICE_PORT:-}"
LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config/defaults}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional variables and variable overrides
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# export variables
export MY_VAR
export LANG TZ DOMANNAME HOSTNAME HOSTADMIN SSL_ENABLED SSL_DIR SSL_CA
export SSL_KEY SSL_DIR HTTP_PORT HTTPS_PORT LOCAL_BIN_DIR DEFAULT_CONF_DIR
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# import variables from file
[ -f "/root/env.sh" ] && . "/root/env.sh"
[ -f "/config/env.sh" ] && "/config/env.sh"
[ -f "/config/.env.sh" ] && . "/config/.env.sh"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set timezone
[ -n "${TZ}" ] && echo "${TZ}" >"/etc/timezone"
[ -f "/usr/share/zoneinfo/${TZ}" ] && ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set hostname
if [ -n "${HOSTNAME}" ]; then
echo "${HOSTNAME}" >"/etc/hostname"
echo "127.0.0.1 ${HOSTNAME} localhost ${HOSTNAME}.local" >"/etc/hosts"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Delete any gitkeep files
[ -d "/data" ] && rm -Rf "/data/.gitkeep" "/data"/*/*.gitkeep
[ -d "/config" ] && rm -Rf "/config/.gitkeep" "/data"/*/*.gitkeep
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setup bin directory
if [ -d "/config/bin" ]; then
for bin in /config/bin/*; do
name="$(basename "$bin")"
ln -sf "$bin" "/usr/local/bin/$name"
done
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create directories
[ -d "/etc/ssl" ] || mkdir -p "/etc/ssl"
[ -d "/usr/local/bin" ] && rm -Rf "/usr/local/bin/.gitkeep"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ "$SSL_ENABLED" = "true" ] || [ "$SSL_ENABLED" = "yes" ]; then
if [ -f "/config/ssl/server.crt" ] && [ -f "/config/ssl/server.key" ]; then
export SSL_ENABLED="true"
if [ -n "$SSL_CA" ] && [ -f "$SSL_CA" ]; then
mkdir -p "/etc/ssl/certs"
cat "$SSL_CA" >>"/etc/ssl/certs/ca-certificates.crt"
fi
else
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
create-ssl-cert
fi
type update-ca-certificates &>/dev/null && update-ca-certificates
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ -f "$SSL_CA" ] && cp -Rfv "$SSL_CA" "/etc/ssl/ca.crt"
[ -f "$SSL_KEY" ] && cp -Rfv "$SSL_KEY" "/etc/ssl/server.key"
[ -f "$SSL_CERT" ] && cp -Rfv "$SSL_CERT" "/etc/ssl/server.crt"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create default config
if [ ! -e "/config/$APPNAME" ] && [ -e "$DEFAULT_CONF_DIR/$APPNAME" ]; then
cp -Rf "$DEFAULT_CONF_DIR/$APPNAME" "/config/$APPNAME"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create config symlinks
if [ -d "/config" ] || [ -n "$(__find "/config" 2>/dev/null)" ]; then
for conf in /config/*; do
if [ -e "/etc/$conf" ]; then
rm -Rf "/etc/${conf:?}"
ln -sf "/config/$conf" "/etc/$conf"
fi
done
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional commands
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case "$1" in
--help) # Help message
echo 'Docker container for '$APPNAME''
echo "Usage: $APPNAME [healthcheck, bash, command]"
echo "Failed command will have exit code 10"
echo ""
exit ${exitCode:-$?}
;;
healthcheck) # Docker healthcheck
__heath_check || exitCode=10
exit ${exitCode:-$?}
;;
*/bin/sh | */bin/bash | bash | shell | sh) # Launch shell
shift 1
__exec_command "${@:-/bin/bash}"
exit ${exitCode:-$?}
;;
podman | docker)
shift 1
podman "$@"
;;
*) # Execute primary command
if [ $# -eq 0 ]; then
podman info
exit ${exitCode:-$?}
else
__exec_command "$@"
exitCode=$?
fi
;;
esac
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# end of entrypoint
exit ${exitCode:-$?}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

0
config/.gitkeep Normal file
View File

0
data/.gitkeep Normal file
View File