Skip to content

Instantly share code, notes, and snippets.

View rwcitek's full-sized avatar

Robert Citek rwcitek

View GitHub Profile
@rwcitek
rwcitek / Docker.Python.Compile.md
Last active February 19, 2023 01:37
Compiling Python in a Docker image.

This is a collection of bash commands that builds a Python binary for a specific Linux environment using Docker. Environment variables are used to set default values, e.g. Python version and compile options. Using those environment variables, a HERE-DOC command creates a Dockerfile. Docker then uses the Dockerfile to build the Python binary within a Docker image.

To see what the latest Python version is, visit https://www.python.org/ftp/python/.

set environment variables ( optional )

Only if you want to use something different from the defaults.

@rwcitek
rwcitek / dood.sh
Last active December 6, 2022 17:32
Docker out of Docker using Ubuntu 22.04
# adapted from: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04
## This allows a Docker container to connect to the Docker server on the host to manage Docker resources
# run a Docker instance in the background
docker container run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
--name dood \
ubuntu:22.04 sleep inf &
@rwcitek
rwcitek / slide-deck.existing.repo.sh
Created November 2, 2022 05:16
Creating a GH pages slide deck inside an existing repo
# This gist combines specific commits from two different repos: jekyll-and-slide and reveal.js
# - https://github.com/adamhollett/jekyll-and-slide
# - https://github.com/hakimel/reveal.js
# If there was a way to do this from the browser, this gist would be unnecessary.
# prerequisite: an existing repo in GitHub, no branch named "gh-pages", and note repo URL
REMOTE_URL='https://github.com/sluugdemogithub/demo03.git'
# create the URL for GitHub Pages
<<< "$REMOTE_URL" IFS='/' read scheme x host id repo
@rwcitek
rwcitek / build.dsub.docker.image.sh
Last active March 16, 2025 12:56
Build dsub Docker image
temp=$(date +%s)
cat <<'eof' > Dockerfile.${temp}
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-c"]
# install the basics
RUN apt-get update && \

This file shows how one can configure a Docker instance to create a serverless function on Digital Ocean. Rather than running doctl auth init ... to set up a config.yaml file that holds the API token, the container exec command passes in an environment variable that contains the token. In that way, the container never has the token on persistent storage. That means the instance could be committed to an image without having credentials in the image. It also means the commands in the Here-Doc could be used as as a template to create a Dockerfile in the future.

From DO function docs

Create a Docker container

@rwcitek
rwcitek / haskell.docker.sh
Last active December 3, 2022 16:45
Installing haskell in an Ubuntu Docker container
# These commands were run using the bash shell on Debian 11 in the Linuv Dev Env on a Chromebook
# make sure no haskell instances exist
docker container stop haskell ; docker container rm haskell ; sleep 2
# run an Ubuntu container in the background
docker container run -d --name haskell ubuntu:22.04 sleep inf
# install utilities and haskell
<<'eof' docker container exec -i haskell /bin/bash
@rwcitek
rwcitek / aoc.2022.day01.sh
Last active December 5, 2022 01:56
Advent of Code 2022 - day 01
# Using a shell pipeline of awk, bc, sort, head in Docker with the Alpine image
<<'eof' docker container run --rm -i alpine
{ cat <<'eof2'
1000
2000
3000
4000
# This should be turned into a multi-stage Dockerfile
docker container stop build_haskell ; docker container rm build_haskell ; sleep 1
docker container run -d --name build_haskell ubuntu:20.04 sleep inf
<<'eof' docker container exec -i -w /tmp/ build_haskell /bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y vim tree jq file wget gcc g++ make xz-utils curl
@rwcitek
rwcitek / mongodb-client.ubuntu-22.04.docker.md
Last active January 25, 2023 17:11
Installing mongodb client on Ubuntu 22.04 in a Docker container
@rwcitek
rwcitek / RPi.Docker.install.sh
Last active December 13, 2022 17:47
Instructions for downloading and imaging the Raspberry Pi 3 image to a USB drive
# From: https://www.simplilearn.com/tutorials/docker-tutorial/raspberry-pi-docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ${USER}
exec sudo su - ${USER}
docker image pull ubuntu:22.04