Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions 01-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/bin/bash

# docker run -d -it --name azcli --mount type=bind,source="/c0de",target=/c0de

# 🍰 https://stackoverflow.com/questions/192319/how-do-i-know-the-script-file-name-in-a-bash-script
# 🍰 https://www.shell-tips.com/bash/environment-variables/
# ------------- SCRIPT ------------- #
#echo
#echo "# arguments called with ----> ${@} "
#echo "# \$1 ----------------------> $1 "
#echo "# \$2 ----------------------> $2 "
#echo "# path to me ---------------> ${0} "
#echo "# parent path --------------> ${0%/*} "
#echo "# my name ------------------> ${0##*/} "
#echo
# ------------- CALLED ------------- #

#* 进口v2 🥾 ALWAYS load c0re Libraries!
source "./_b00t_.bashrc"

# verify docker has buildx
# docker buildx version
# github.com/docker/buildx v0.5.1-docker 11057da37336192bfc57d81e02359ba7ba848e4a

#if [ -z "$AZURE_TENANT_ID" ] ; then
# azure
# read -p '🤖 Azure TENANT_ID: ' AZURE_TENANT_ID
#fi
# 7e8f7eda-7eff-483f-a415-77241728783b


#AZ_RESOURCE_ID=
#select character in Sheldon Leonard Penny Howard Raj
#do
# echo "Selected character: $character"
# echo "Selected number: $REPLY"
#done

#this will setup your local instance with boot.
#if [ 0 ] ; then
#motd
#echo "then something like this ... "
#echo "
#Project: $project
#
#type of environment
# 😁 welcome: new user / tutorial
# 🌌 config: config a project
# ☠️ deploy: deploy a project #
#
#"
#fi

## enable extra repos (for stuff like ffmpeg)
## https://linuxconfig.org/how-to-enable-disable-universe-multiverse-and-restricted-repository-on-ubuntu-20-04-lts-focal-fossa
#
# - canonical "main" is free/open-source
# - universe is community maintained, free/open
sudo add-apt-repository universe
# - multiverse is restricted by copyright or legal issues
# sudo add-apt-repository multiverse
# - restricted is proprietary device drivers.
# sudo add-apt-repository restricted


## list all init-files (excluding template) in the bash bash.🔨/
for bashrc in `/usr/bin/fdfind --type x --glob "init*.sh" $_B00T_C0DE_Path/bash.🔨/ | sort` ;
do
echo $bashrc ;
bash_source_加载 $bashrc
done


## 进口 (Jìnkǒu :: Import/Load PHASE 1 * \\
# _b00t_ Bin shell & helpers, logging.
# bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.10*.🥾.*.sh"


## 进口 (Jìnkǒu :: Import/Load) PHASE 2 * * \\
# Two is Torvalds Tech (Linux & Git)
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🐧.*.sh"
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🐙.*.sh"

# Also, Docker
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🐳.*.sh"

## 进口 (Jìnkǒu :: Import/Load) PHASE 3 * * * \\
## minimal c0re Python 🐍
# + establish .venv
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🐍.*sh"
#source .venv/bin/activate

## Typescript & Node
# bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🚀.*.sh"
# Future:
# bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🦄.*.sh"

## 进口 (Jìnkǒu :: Import/Load) PHASE 4 * * * * \\
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.🤖.*.sh"
#bash_source_加载 "$_B00T_C0DE_Path/./bash.🔨/init.*.👾.*.sh"

# AWS, etc.
# bash_source_加载 "$_B00T_C0DE_Path/./bash/c0re_init.*.🦉.sh"

## 进口 * * * //


##* * * * \\
# 目录 (Mùlù) Directory
#if [ -d "$c0dePath/./pr0j3cts/./$project_dir" ] ; then
# export PROJECT_dirExist=`$c0dePath/./pr0j3cts/./$project_dir`
# echo "🥾 the $c0dePath/./pr0j3cts/./$project_dir already exists use --force"
#else
# export PROJECT_dirExists=""
#fi
#mkdir -p "$c0dePath/./pr0j3cts/./$project"
##* * * * //

#* 🐳 docker setup.

# TODO: link to the Elasticdotventures repository
#
#docker build -t cowsay .
# 🐳♻️ It’s a good habit to use --rm to avoid filling up your system with stale Docker containers.
#docker run --rm cowsay

#sh >out <<EOF
#🐛 If you didn't get a cowsay, let me know.
#
#🤓 at this point you can start to build using EV _b00t_ or
#your own _b00t_.

#type:
#git clone https://github.com/elasticdotventures/_b00t_/generate

#EOF

#echo "* if you just saw a talking cow, everything is fine!"
#echo "run ./02_t00ls_.sh"


18 changes: 18 additions & 0 deletions 02-create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 02-create.py

import:
gh repo create

cd /c0re/
git clone https://github.com/elasticdotventures/d0ngxi
cd d0ngxi

# https://github.com/elasticdotventures/d0ngxi


## VS CODE
# code --install-extension
# code --new-window
# code --reuse-window

# exceedsystem.vscode-macros
9 changes: 9 additions & 0 deletions 02-tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/python


docker build -t my_docker . --build-arg arrrg=45

#
asciinema rec
sudo pip3 install asciinema
asciinema auth
131 changes: 131 additions & 0 deletions Dockerfile.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# syntax=docker/dockerfile:latest

# TO BUILD:
# ./build.sh
# TO RUN:


# Docker uses the default 172.17.0.0/16 subnet for container networking.

# FROM python:3.7-alpine

# shows secret from default secret location:
# RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret

# USER root
# SHELL /bin/bash

# 🤓 Dockerfile Best Practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
# 🤓 Buildkit syntax
# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md

# docker CLI syntax
# -f :: changes context

# 🤔 Dockerfile can be sent via stdin
# tools like terraform, etc. can generate these
# there is also developer libraries

# passing ARGS
# An ARG declared before a FROM is outside of a build stage,
# AND therefore can’t be used in any instruction after a FROM
# ARG outside_build_stage

####
# Step1: init
FROM jrei/systemd-ubuntu as b00t_1n1t
ARG arrgh
ENV "STAGE"="1n1t"
RUN echo "🥾🐳 1n1t"
RUN echo "STAGE: ${STAGE} arrgh: ${arrgh}"

# Howto setup squid proxy as a sidecar container and have APT use it.
## https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/
RUN \
if [ -n "$http_proxy" ]; then \
echo "Acquire { \
HTTP::proxy \"$http_proxy\"; \
HTTPS::proxy \"$https_proxy\"; \
}" > /etc/apt/apt.conf.d/http_proxy_b00t_squid; \
fi
RUN echo "apt update -y && apt upgrade -y && apt-get install -y apt-utils"

## NOTE: if squid caching proxy had issue, these lies can cache bad values.
RUN apt-get clean && apt-get update -y && apt-get upgrade -y
# Timezone
ENV DEBIAN_FRONTEND "noninteractive"
ENV TZ "Australia/Melbourne"
RUN apt-get -y install apt-utils tzdata locales

# Emoji Support
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

####
# Step2: base (everything)
FROM b00t_1n1t as b00t_b4s3
RUN echo "🥾🐳 B4S3"
MAINTAINER [email protected]


FROM b00t_b4s3 as b00t_m4k3


## DOCKER BUILD ENHANCEMENTS
## https://docs.docker.com/develop/develop-images/build_enhancements/
##
# download github public key
#RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
# clone private repo
#RUN --mount=type=ssh git clone [email protected]:myorg/myproject.git myproject
# must run
# $ docker build --ssh default .
# docker --compress

## Dev/test git, gcc, g++
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt update && apt-get --no-install-recommends install -y apt-utils git gcc g++
#RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
# apt update && apt-get --no-install-recommends install -y gcc

# RUN apt-get update && apt-get install -y git gcc g++
RUN git --version
RUN apt-get install -y apt-utils dialog curl wget ca-certificates gnupg

# https://stackoverflow.com/questions/27701930/how-to-add-users-to-docker-container
RUN gosu groupadd docker
RUN useradd --create-home --gid docker brianh


# TODO: setup ps1, etc.

#VOLUME "/c0de/_b00t_"
#COPY ./docker.🐳 /c0de/_b00t_/docker.🐳/
WORKDIR /c0de/_b00t_/
ADD ./*.sh "./"
ADD ./*.bashrc "./"
# ADD /c0de/
RUN chmod +x ./source.sh

## this was screwing up permissions:
#RUN useradd -ms /bin/bash brianh
#USER brianh
#WORKDIR /home/brianh

## Stage2
FROM b00t_base as b00t_init
# CURRENT ISSUE:
# file always rebuilds, full build takes too long,
# not using stages YET
#RUN /c0de/_b00t_/source.sh "./bash.🔨/init.*.🥾.*.sh";
RUN --mount=type=bind,target="/c0de/b00t",ro
ADD "./_b00t_.bashrc" "./"
ADD "./source.sh" "./"
#RUN chmod +x "_b00t_.bashrc"


CMD [ "/bin/bash", "-c", "/c0de/_b00t_/_b00t_.bashrc"]
Loading
Loading