Skip to content

Instantly share code, notes, and snippets.

View BretFisher's full-sized avatar
🗃️
All Day Containers!

Bret Fisher BretFisher

🗃️
All Day Containers!
View GitHub Profile
@BretFisher
BretFisher / Dockerfile
Created August 27, 2024 20:22
Adding a non-root user to an Alpine Docker image. This example uses the python image, but it works the same in other Alpine images.
# syntax=docker/dockerfile:1
FROM python:alpine
# create the group and user
RUN addgroup -g 1000 python \
&& adduser -u 1000 -G python -D python
# stating USER before WORKDIR means the directory is created with the non-root proper ownership
USER python
WORKDIR /app
@BretFisher
BretFisher / starship.toml
Created March 25, 2023 02:43
Bret's Starship TOML tweaks
# Replace the "❯" symbol in the prompt with "🥃"
[character]
success_symbol = "[🥃](bold green)"
[[battery.display]]
threshold = 75 # only show me battery status below 75%
[directory]
truncation_length = 5
truncation_symbol = '…/'
@BretFisher
BretFisher / Dockerfile
Last active June 14, 2024 04:22
Multi-stage Dockerfile example of installing dependencies with COPY --from
# any images you use later, add them here first to create aliases
# I like keeping all my versions at the top
FROM node:14.3-slim as node
FROM php:7.2.1-fpm-slim as php
FROM nginx:1.17 as nginx
# The real base image to start from
FROM ubuntu:focal-20210827 as base
# install apt stuff
@BretFisher
BretFisher / cert.sh
Created August 13, 2020 18:45
docker compose with traefik and certs
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DOMAIN_NAME=$1
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
@BretFisher
BretFisher / certs.sh
Last active August 13, 2020 18:29
quickly make a local tls cert
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DOMAIN_NAME=$1
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
@BretFisher
BretFisher / gruvbox-light.js
Last active May 17, 2020 17:31 — forked from anhari/gist:23ae031e93e2f465258439cb6802acad
gruvbox *light* blink shell theme
black = '#fbf1c7';
red = '#cc241d'; // red
green = '#98971a'; // green
yellow = '#d79921'; // yellow
blue = '#458588'; // blue
magenta = '#b16286'; // pink
cyan = '#689d6a'; // cyan
white = '#7c6f64'; // light gray
lightBlack = '#928374'; // medium gray
lightRed = '#9d0006'; // red
@BretFisher
BretFisher / halloween.md
Created October 31, 2019 20:46
Scary Course Sale for Halloween
@BretFisher
BretFisher / .zshrc
Created July 4, 2018 20:52
my custom oh-my-zsh setup
# this assumes your using oh-my-zsh for maximum zsh-ness
# info and defaults are here:
# https://github.com/robbyrussell/oh-my-zsh/blob/master/templates/zshrc.zsh-template
export LC_ALL="en_US.UTF-8"
export ZSH=/Users/bret/.oh-my-zsh
# custom prompt theme
ZSH_THEME="present" # mine is present, default is robbyrussell, also agnoster, fishy, ys, wild-cherry
COMPLETION_WAITING_DOTS="true"
@BretFisher
BretFisher / docker-alias.sh
Created April 22, 2018 04:06
Docker Alias common stuff, mostly from oh-my-zsh
dcb='docker-compose build'
dcdn='docker-compose down'
dce='docker-compose exec'
dcl='docker-compose logs'
dclf='docker-compose logs -f'
dco=docker-compose
dcps='docker-compose ps'
dcr='docker-compose run'
dcrestart='docker-compose restart'
dcrm='docker-compose rm'
@BretFisher
BretFisher / docker-for-windows.md
Last active August 6, 2024 18:02
Getting a Shell in the Docker for Windows Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1