mirror of
				https://github.com/casjaysdevdocker/code
				synced 2025-11-03 19:02:09 -05:00 
			
		
		
		
	🦈🏠🐜❗ Initial Commit ❗🐜🦈🏠
This commit is contained in:
		
							
								
								
									
										4
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
# Files to ignore
 | 
			
		||||
.gitkeep
 | 
			
		||||
.gitignore
 | 
			
		||||
.node_modules/**
 | 
			
		||||
							
								
								
									
										93
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
# gitignore created on 10/17/22 at 10:13
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										121
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,121 @@
 | 
			
		||||
FROM casjaysdevdocker/debian:latest AS build
 | 
			
		||||
 | 
			
		||||
ARG DEBIAN_VERSION="bullseye"
 | 
			
		||||
 | 
			
		||||
ARG 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 LANG=en_US.utf8 \
 | 
			
		||||
  TZ="America/New_York" \
 | 
			
		||||
  SHELL="/bin/bash" \
 | 
			
		||||
  TERM="xterm-256color" \
 | 
			
		||||
  DEBIAN_FRONTEND="noninteractive" \
 | 
			
		||||
  TOR_BROWSER_VERSION="11.5.4"
 | 
			
		||||
 | 
			
		||||
COPY ./bin/. /usr/local/bin/
 | 
			
		||||
COPY ./config/. ${DEFAULT_CONF_DIR}/
 | 
			
		||||
COPY ./data/. ${DEFAULT_DATA_DIR}/
 | 
			
		||||
 | 
			
		||||
RUN set -ex;   rm -Rf "/etc/apt/sources.list" ;   mkdir -p "${DEFAULT_DATA_DIR}" "${DEFAULT_CONF_DIR}" "${DEFAULT_TEMPLATE_DIR}" "/etc/sudoers.d" "/tmp/tor-profile"; \
 | 
			
		||||
  echo 'export DEBIAN_FRONTEND="noninteractive"' >"/etc/profile.d/apt.sh" && chmod 755 "/etc/profile.d/apt.sh" && \
 | 
			
		||||
  echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION} main contrib non-free" >>"/etc/apt/sources.list" ; \
 | 
			
		||||
  echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION}-updates main contrib non-free" >>"/etc/apt/sources.list" ; \
 | 
			
		||||
  echo "deb http://deb.debian.org/debian-security/ ${DEBIAN_VERSION}-security main contrib non-free" >>"/etc/apt/sources.list" ; \
 | 
			
		||||
  apt-get update -yy && apt-get upgrade -yy && apt-get install -yy \
 | 
			
		||||
  apt-transport-https \
 | 
			
		||||
  bash \
 | 
			
		||||
  sudo \
 | 
			
		||||
  tini \
 | 
			
		||||
  xorg \
 | 
			
		||||
  x11-apps \
 | 
			
		||||
  xz-utils \
 | 
			
		||||
  wget \
 | 
			
		||||
  gpg \
 | 
			
		||||
  gpg \
 | 
			
		||||
  wget \
 | 
			
		||||
  curl \
 | 
			
		||||
  iproute2 && \
 | 
			
		||||
  wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
 | 
			
		||||
  install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg && \
 | 
			
		||||
  echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" >"/etc/apt/sources.list.d/vscode.list" && \
 | 
			
		||||
  apt-get update -yy && apt-get upgrade -yy && apt-get install -yy code -yy && \
 | 
			
		||||
  useradd --shell /bin/bash --create-home --home-dir /home/x11user x11user && \
 | 
			
		||||
  usermod -a -G audio,video,sudo,tty,dialout,cdrom,floppy,audio,dip,video,plugdev x11user && \
 | 
			
		||||
  echo "x11user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/x11user" && \
 | 
			
		||||
  apt-get clean
 | 
			
		||||
 | 
			
		||||
RUN sudo -u x11user setup-code.sh && \
 | 
			
		||||
  chown -Rf x11user:x11user "/home/x11user"
 | 
			
		||||
 | 
			
		||||
RUN echo 'Running cleanup' ; \
 | 
			
		||||
  update-alternatives --install /bin/sh sh /bin/bash 1 ; \
 | 
			
		||||
  rm -Rf /usr/share/doc/* /usr/share/info/* packages.microsoft.gpg ; \
 | 
			
		||||
  rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ; \
 | 
			
		||||
  rm -Rf /usr/local/bin/.gitkeep /config /data /var/lib/apt/lists/* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/multi-user.target.wants/* ; \
 | 
			
		||||
  rm -rf /etc/systemd/system/*.wants/* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/local-fs.target.wants/* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/sockets.target.wants/*udev* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/sockets.target.wants/*initctl* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* ; \
 | 
			
		||||
  rm -rf /lib/systemd/system/systemd-update-utmp* ; \
 | 
			
		||||
  if [ -d "/lib/systemd/system/sysinit.target.wants" ]; then cd "/lib/systemd/system/sysinit.target.wants" ; fi
 | 
			
		||||
 | 
			
		||||
#FROM scratch
 | 
			
		||||
 | 
			
		||||
ARG PHP_SERVER="php" \
 | 
			
		||||
  NODE_VERSION="14" \
 | 
			
		||||
  NODE_MANAGER="system" \
 | 
			
		||||
  SERVICE_PORT="" \
 | 
			
		||||
  EXPOSE_PORTS="" \
 | 
			
		||||
  LICENSE="MIT" \
 | 
			
		||||
  IMAGE_NAME="code" \
 | 
			
		||||
  BUILD_VERSION="latest" \
 | 
			
		||||
  TIMEZONE="America/New_York" \
 | 
			
		||||
  BUILD_DATE="2022-10-15"
 | 
			
		||||
 | 
			
		||||
LABEL maintainer="CasjaysDev <docker-admin@casjaysdev.com>" \
 | 
			
		||||
  org.opencontainers.image.vendor="CasjaysDev" \
 | 
			
		||||
  org.opencontainers.image.authors="CasjaysDev" \
 | 
			
		||||
  org.opencontainers.image.vcs-type="Git" \
 | 
			
		||||
  org.opencontainers.image.name="${IMAGE_NAME}" \
 | 
			
		||||
  org.opencontainers.image.base.name="${IMAGE_NAME}" \
 | 
			
		||||
  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/${IMAGE_NAME}" \
 | 
			
		||||
  org.opencontainers.image.vcs-url="https://github.com/casjaysdevdocker/${IMAGE_NAME}" \
 | 
			
		||||
  org.opencontainers.image.url.source="https://github.com/casjaysdevdocker/${IMAGE_NAME}" \
 | 
			
		||||
  org.opencontainers.image.documentation="https://hub.docker.com/r/casjaysdevdocker/${IMAGE_NAME}" \
 | 
			
		||||
  org.opencontainers.image.description="Containerized version of ${IMAGE_NAME}"
 | 
			
		||||
 | 
			
		||||
ENV LANG=en_US.utf8 \
 | 
			
		||||
  ENV=~/.bashrc \
 | 
			
		||||
  SHELL="/bin/bash" \
 | 
			
		||||
  PORT="${SERVICE_PORT}" \
 | 
			
		||||
  TERM="xterm-256color" \
 | 
			
		||||
  PHP_SERVER="${PHP_SERVER}" \
 | 
			
		||||
  NODE_VERSION="${NODE_VERSION}" \
 | 
			
		||||
  NODE_MANAGER="${NODE_MANAGER}" \
 | 
			
		||||
  CONTAINER_NAME="${IMAGE_NAME}" \
 | 
			
		||||
  TZ="${TZ:-America/New_York}" \
 | 
			
		||||
  TIMEZONE="${TZ:-$TIMEZONE}" \
 | 
			
		||||
  HOSTNAME="casjaysdev-${IMAGE_NAME}" \
 | 
			
		||||
  USER="x11user"
 | 
			
		||||
 | 
			
		||||
#COPY --from=build /. /
 | 
			
		||||
 | 
			
		||||
USER x11user
 | 
			
		||||
WORKDIR /home/x11user
 | 
			
		||||
 | 
			
		||||
VOLUME [ "/data", "/tmp/.X11-unix", "${HOME}/.Xauthority", ]
 | 
			
		||||
 | 
			
		||||
EXPOSE $EXPOSE_PORTS
 | 
			
		||||
 | 
			
		||||
CMD [ "$@" ]
 | 
			
		||||
ENTRYPOINT [ "tini", "-p", "SIGTERM", "--", "/usr/local/bin/entrypoint-code.sh" ]
 | 
			
		||||
HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-code.sh", "healthcheck" ]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								LICENSE.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								LICENSE.md
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										36
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
## 👋 Welcome to code 🚀  
 | 
			
		||||
 | 
			
		||||
code 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 code
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
OR
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
git clone "https://github.com/casjaysdevdocker/code" "$HOME/Projects/github/casjaysdevdocker/code"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Build container  
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
cd "$HOME/Projects/github/casjaysdevdocker/code"
 | 
			
		||||
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) ⛵  
 | 
			
		||||
							
								
								
									
										168
									
								
								bin/entrypoint-code.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										168
									
								
								bin/entrypoint-code.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,168 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# shellcheck shell=bash
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
##@Version           :  202210162159-git
 | 
			
		||||
# @@Author           :  Jason Hempstead
 | 
			
		||||
# @@Contact          :  jason@casjaysdev.com
 | 
			
		||||
# @@License          :  WTFPL
 | 
			
		||||
# @@ReadME           :  entrypoint-code.sh --help
 | 
			
		||||
# @@Copyright        :  Copyright: (c) 2022 Jason Hempstead, Casjays Developments
 | 
			
		||||
# @@Created          :  Sunday, Oct 16, 2022 21:59 EDT
 | 
			
		||||
# @@File             :  entrypoint-code.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="202210162159-git"
 | 
			
		||||
HOME="${USER_HOME:-$HOME}"
 | 
			
		||||
USER="${SUDO_USER:-$USER}"
 | 
			
		||||
RUN_USER="${SUDO_USER:-$USER}"
 | 
			
		||||
SCRIPT_SRC_DIR="${BASH_SOURCE%/*}"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Set functions
 | 
			
		||||
__exec_command() {
 | 
			
		||||
  local exitCode=0
 | 
			
		||||
  local cmd="${*:-bash -l}"
 | 
			
		||||
  echo "Executing command: $cmd"
 | 
			
		||||
  eval "$cmd" || exitCode=1
 | 
			
		||||
  [ "$exitCode" = 0 ] || exitCode=10
 | 
			
		||||
  return ${exitCode:-$?}
 | 
			
		||||
}
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Additional functions
 | 
			
		||||
__pgrep() { ps aux 2>/dev/null | grep -F "$@" | grep -qv 'grep' || return 10; }
 | 
			
		||||
__find() { find "$1" -mindepth 1 -type f,d 2>/dev/null | grep '^' || return 10; }
 | 
			
		||||
__curl() { curl -q -LSsf -o /dev/null -s -w "200" "$@" 2>/dev/null || return 10; }
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
__certbot() {
 | 
			
		||||
  [ -n "$SSL_CERT_BOT" ] && type -P certbot &>/dev/null || { export SSL_CERT_BOT="" && return 10; }
 | 
			
		||||
  certbot certonly --webroot -w "${WWW_ROOT_DIR:-/data/htdocs/www}" -d $DOMANNAME -d $DOMANNAME \
 | 
			
		||||
    --put-all-related-files-into "$SSL_DIR" –key-path "$SSL_KEY" –fullchain-path "$SSL_CERT"
 | 
			
		||||
}
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
__heath_check() {
 | 
			
		||||
  status=0 health="Good"
 | 
			
		||||
  __pgrep "${1:-$SERVICE_NAME}" || status=$((status + 1))
 | 
			
		||||
  #__curl "http://localhost:$HTTP_PORT/server-health" || status=$((status + 1))
 | 
			
		||||
  [ "$status" -eq 0 ] || health="Errors reported see docker logs --follow $CONTAINER_NAME"
 | 
			
		||||
  echo "$(uname -s) $(uname -m) is running and the health is: $health"
 | 
			
		||||
  return ${status:-$?}
 | 
			
		||||
}
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# export functions
 | 
			
		||||
export -f __exec_command __pgrep __find __curl __heath_check
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Define default variables - do not change these - redifine with -e or set under Additional
 | 
			
		||||
DISPLAY="${DISPLAY:-}"
 | 
			
		||||
LANG="${LANG:-C.UTF-8}"
 | 
			
		||||
DOMANNAME="${DOMANNAME:-}"
 | 
			
		||||
TZ="${TZ:-America/New_York}"
 | 
			
		||||
HTTP_PORT="${HTTP_PORT:-80}"
 | 
			
		||||
HTTPS_PORT="${HTTPS_PORT:-443}"
 | 
			
		||||
SERVICE_PORT="${SERVICE_PORT:-}"
 | 
			
		||||
SERVICE_NAME="${CONTAINER_NAME}"
 | 
			
		||||
HOSTNAME="${HOSTNAME:-casjaysdev-code}"
 | 
			
		||||
HOSTADMIN="${HOSTADMIN:-root@${DOMANNAME:-$HOSTNAME}}"
 | 
			
		||||
SSL_CERT_BOT="${SSL_CERT_BOT:-false}"
 | 
			
		||||
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}"
 | 
			
		||||
SSL_CONTAINER_DIR="${SSL_CONTAINER_DIR:-/etc/ssl/CA}"
 | 
			
		||||
WWW_ROOT_DIR="${WWW_ROOT_DIR:-/data/htdocs}"
 | 
			
		||||
LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
 | 
			
		||||
DEFAULT_DATA_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/data}"
 | 
			
		||||
DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}"
 | 
			
		||||
DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}"
 | 
			
		||||
CONTAINER_IP_ADDRESS="$(ip a | grep 'inet' | grep -v '127.0.0.1' | awk '{print $2}' | sed 's|/*||g')"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Additional variables and variable overrides
 | 
			
		||||
#export SERVICE_NAME=""
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# export variables
 | 
			
		||||
export LANG TZ DOMANNAME HOSTNAME HOSTADMIN SSL_ENABLED SSL_DIR SSL_CA SSL_KEY
 | 
			
		||||
export SSL_DIR HTTP_PORT HTTPS_PORT LOCAL_BIN_DIR DEFAULT_CONF_DIR CONTAINER_IP_ADDRESS
 | 
			
		||||
export SSL_CONTAINER_DIR SSL_CERT_BOT DISPLAY
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# 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}" | sudo tee "/etc/timezone" >/dev/null >/dev/null
 | 
			
		||||
[ -f "/usr/share/zoneinfo/${TZ}" ] && sudo ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Set hostname
 | 
			
		||||
if [ -n "${HOSTNAME}" ]; then
 | 
			
		||||
  echo "${HOSTNAME}" | sudo tee "/etc/hostname" >/dev/null
 | 
			
		||||
  echo "127.0.0.1 ${HOSTNAME} localhost ${HOSTNAME}.local" | sudo tee "/etc/hosts" >/dev/null
 | 
			
		||||
fi
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Add domain to hosts file
 | 
			
		||||
if [ -n "$DOMANNAME" ]; then
 | 
			
		||||
  echo "${HOSTNAME}.${DOMANNAME:-local}" | sudo tee "/etc/hostname" >/dev/null
 | 
			
		||||
  echo "127.0.0.1 ${HOSTNAME} localhost ${HOSTNAME}.local" | sudo tee "/etc/hosts" >/dev/null
 | 
			
		||||
  echo "${CONTAINER_IP_ADDRESS:-127.0.0.1} ${HOSTNAME}.${DOMANNAME}" | sudo tee -a "/etc/hosts" >/dev/null
 | 
			
		||||
fi
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Create files
 | 
			
		||||
mkdir -p "/config" "/data"
 | 
			
		||||
if [ -d "/config/vscode" ]; then
 | 
			
		||||
  rm -Rf "$HOME/.vscode"
 | 
			
		||||
  ln -sf "/config/vscode" "$HOME/.vscode"
 | 
			
		||||
else
 | 
			
		||||
  mv -fv "$HOME/.vscode" "/config/vscode"
 | 
			
		||||
  ln -sf "/config/vscode" "$HOME/.vscode"
 | 
			
		||||
fi
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
if [ -d "/config/code" ]; then
 | 
			
		||||
  rm -Rf "$HOME/.config/Code"
 | 
			
		||||
  ln -sf "/config/code" "$HOME/.config/Code"
 | 
			
		||||
else
 | 
			
		||||
  mv -fv "$HOME/.config/Code" "/config/code"
 | 
			
		||||
  ln -sf "/config/code" "$HOME/.config/Code"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Fic permissions
 | 
			
		||||
sudo chown -Rf x11user:x11user "/data" "/config"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
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:-$?}
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
*) # Execute primary command
 | 
			
		||||
  start-code "$@"
 | 
			
		||||
  [ -f "/tmp/init.pid" ] || { touch "/tmp/init.pid" && bash -l; }
 | 
			
		||||
  ;;
 | 
			
		||||
esac
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# end of entrypoint
 | 
			
		||||
exit ${exitCode:-$?}
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
							
								
								
									
										100
									
								
								bin/setup-code.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										100
									
								
								bin/setup-code.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,100 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# shellcheck shell=bash
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
##@Version           :  202210162208-git
 | 
			
		||||
# @@Author           :  Jason Hempstead
 | 
			
		||||
# @@Contact          :  jason@casjaysdev.com
 | 
			
		||||
# @@License          :  WTFPL
 | 
			
		||||
# @@ReadME           :  setup-code.sh --help
 | 
			
		||||
# @@Copyright        :  Copyright: (c) 2022 Jason Hempstead, Casjays Developments
 | 
			
		||||
# @@Created          :  Sunday, Oct 16, 2022 22:08 EDT
 | 
			
		||||
# @@File             :  setup-code.sh
 | 
			
		||||
# @@Description      :
 | 
			
		||||
# @@Changelog        :  New script
 | 
			
		||||
# @@TODO             :  Better documentation
 | 
			
		||||
# @@Other            :
 | 
			
		||||
# @@Resource         :
 | 
			
		||||
# @@Terminal App     :  no
 | 
			
		||||
# @@sudo/root        :  no
 | 
			
		||||
# @@Template         :  other/start-service
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
code --install-extension "aaron-bond.better-comments" --force
 | 
			
		||||
code --install-extension "bengreenier.vscode-node-readme" --force
 | 
			
		||||
code --install-extension "bierner.emojisense" --force
 | 
			
		||||
code --install-extension "bierner.github-markdown-preview" --force
 | 
			
		||||
code --install-extension "bierner.markdown-checkbox" --force
 | 
			
		||||
code --install-extension "bierner.markdown-emoji" --force
 | 
			
		||||
code --install-extension "bierner.markdown-footnotes" --force
 | 
			
		||||
code --install-extension "bierner.markdown-mermaid" --force
 | 
			
		||||
code --install-extension "bierner.markdown-preview-github-styles" --force
 | 
			
		||||
code --install-extension "bierner.markdown-yaml-preamble" --force
 | 
			
		||||
code --install-extension "bmalehorn.vscode-fish" --force
 | 
			
		||||
code --install-extension "bungcip.better-toml" --force
 | 
			
		||||
code --install-extension "christian-kohler.npm-intellisense" --force
 | 
			
		||||
code --install-extension "Cjay.ruby-and-rails-snippets" --force
 | 
			
		||||
code --install-extension "compilouit.manpage" --force
 | 
			
		||||
code --install-extension "coolbear.systemd-unit-file" --force
 | 
			
		||||
code --install-extension "d9705996.perl-toolbox" --force
 | 
			
		||||
code --install-extension "DavidAnson.vscode-markdownlint" --force
 | 
			
		||||
code --install-extension "dbaeumer.vscode-eslint" --force
 | 
			
		||||
code --install-extension "denoland.vscode-deno" --force
 | 
			
		||||
code --install-extension "dnicolson.binary-plist" --force
 | 
			
		||||
code --install-extension "dotiful.dotfiles-syntax-highlighting" --force
 | 
			
		||||
code --install-extension "DotJoshJohnson.xml" --force
 | 
			
		||||
code --install-extension "dsznajder.es7-react-js-snippets" --force
 | 
			
		||||
code --install-extension "duniul.dircolors" --force
 | 
			
		||||
code --install-extension "dunstontc.viml" --force
 | 
			
		||||
code --install-extension "EditorConfig.EditorConfig" --force
 | 
			
		||||
code --install-extension "eiminsasete.apacheconf-snippets" --force
 | 
			
		||||
code --install-extension "esbenp.prettier-vscode" --force
 | 
			
		||||
code --install-extension "file-icons.file-icons" --force
 | 
			
		||||
code --install-extension "formulahendry.auto-rename-tag" --force
 | 
			
		||||
code --install-extension "foxundermoon.shell-format" --force
 | 
			
		||||
code --install-extension "ginfuru.ginfuru-vscode-jekyll-syntax" --force
 | 
			
		||||
code --install-extension "ginfuru.vscode-jekyll-snippets" --force
 | 
			
		||||
code --install-extension "glenn2223.live-sass" --force
 | 
			
		||||
code --install-extension "hangxingliu.vscode-nginx-conf-hint" --force
 | 
			
		||||
code --install-extension "HexcodeTechnologies.vscode-prettydiff" --force
 | 
			
		||||
code --install-extension "hogashi.crontab-syntax-highlight" --force
 | 
			
		||||
code --install-extension "justusadam.language-haskell" --force
 | 
			
		||||
code --install-extension "keyring.Lua" --force
 | 
			
		||||
code --install-extension "malmaud.tmux" --force
 | 
			
		||||
code --install-extension "MariusAlchimavicius.json-to-ts" --force
 | 
			
		||||
code --install-extension "mechatroner.rainbow-csv" --force
 | 
			
		||||
code --install-extension "mrmlnc.vscode-apache" --force
 | 
			
		||||
code --install-extension "ms-azuretools.vscode-docker" --force
 | 
			
		||||
code --install-extension "ms-vscode-remote.remote-containers" --force
 | 
			
		||||
code --install-extension "ms-vscode.powershell" --force
 | 
			
		||||
code --install-extension "ms-vscode.vscode-typescript-tslint-plugin" --force
 | 
			
		||||
code --install-extension "nico-castell.linux-desktop-file" --force
 | 
			
		||||
code --install-extension "octref.vetur" --force
 | 
			
		||||
code --install-extension "oderwat.indent-rainbow" --force
 | 
			
		||||
code --install-extension "piotrpalarz.vscode-gitignore-generator" --force
 | 
			
		||||
code --install-extension "quicktype.quicktype" --force
 | 
			
		||||
code --install-extension "rebornix.ruby" --force
 | 
			
		||||
code --install-extension "redhat.vscode-yaml" --force
 | 
			
		||||
code --install-extension "ritwickdey.LiveServer" --force
 | 
			
		||||
code --install-extension "rohgarg.jekyll-post" --force
 | 
			
		||||
code --install-extension "rpinski.shebang-snippets" --force
 | 
			
		||||
code --install-extension "sastan.twind-intellisense" --force
 | 
			
		||||
code --install-extension "Shan.code-settings-sync" --force
 | 
			
		||||
code --install-extension "sidneys1.gitconfig" --force
 | 
			
		||||
code --install-extension "sissel.shopify-liquid" --force
 | 
			
		||||
code --install-extension "streetsidesoftware.code-spell-checker" --force
 | 
			
		||||
code --install-extension "swyphcosmo.spellchecker" --force
 | 
			
		||||
code --install-extension "syler.sass-indented" --force
 | 
			
		||||
code --install-extension "tanming363.bootstrap-v4" --force
 | 
			
		||||
code --install-extension "timonwong.shellcheck" --force
 | 
			
		||||
code --install-extension "TzachOvadia.todo-list" --force
 | 
			
		||||
code --install-extension "VisualStudioExptTeam.intellicode-api-usage-examples" --force
 | 
			
		||||
code --install-extension "VisualStudioExptTeam.vscodeintellicode" --force
 | 
			
		||||
code --install-extension "vscode-icons-team.vscode-icons" --force
 | 
			
		||||
code --install-extension "vscode-snippet.snippet" --force
 | 
			
		||||
code --install-extension "WakaTime.vscode-wakatime" --force
 | 
			
		||||
code --install-extension "wingrunr21.vscode-ruby" --force
 | 
			
		||||
code --install-extension "Wscats.eno" --force
 | 
			
		||||
code --install-extension "yinfei.luahelper" --force
 | 
			
		||||
code --install-extension "yzhang.markdown-all-in-one" --force
 | 
			
		||||
code --install-extension "ZainChen.json" --force
 | 
			
		||||
curl -q -LSsf "https://github.com/casjay/vs-code/raw/main/settings-linux.json" -o "$HOME/.config/Code/User/settings.json"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								bin/start-code
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								bin/start-code
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# shellcheck shell=bash
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
##@Version           :  202210162304-git
 | 
			
		||||
# @@Author           :  Jason Hempstead
 | 
			
		||||
# @@Contact          :  jason@casjaysdev.com
 | 
			
		||||
# @@License          :  WTFPL
 | 
			
		||||
# @@ReadME           :  start-code --help
 | 
			
		||||
# @@Copyright        :  Copyright: (c) 2022 Jason Hempstead, Casjays Developments
 | 
			
		||||
# @@Created          :  Sunday, Oct 16, 2022 23:04 EDT
 | 
			
		||||
# @@File             :  start-code
 | 
			
		||||
# @@Description      :
 | 
			
		||||
# @@Changelog        :  New script
 | 
			
		||||
# @@TODO             :  Better documentation
 | 
			
		||||
# @@Other            :
 | 
			
		||||
# @@Resource         :
 | 
			
		||||
# @@Terminal App     :  no
 | 
			
		||||
# @@sudo/root        :  no
 | 
			
		||||
# @@Template         :  other/start-service
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
[ "$1" = "" ] && shift 1
 | 
			
		||||
[ "$1" = " " ] && shift 1
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
WORK_DIR="${1:-/data}"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
code -wn "$WORK_DIR"
 | 
			
		||||
							
								
								
									
										0
									
								
								config/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
		Reference in New Issue
	
	Block a user