Skip to content

Instantly share code, notes, and snippets.

@arctic-hen7
Last active June 24, 2024 02:20
Show Gist options
  • Save arctic-hen7/bbfcc3021f7592d2013ee70470fee60b to your computer and use it in GitHub Desktop.
Save arctic-hen7/bbfcc3021f7592d2013ee70470fee60b to your computer and use it in GitHub Desktop.
ZSH configuration for nice Docker shells in Alpine
# Note: for this to do anything, use my starter Dockerfile config (https://gist.github.com/arctic-hen7/10987790b86360820e2790650e289f0b)
# This file contains ZSH configuration for your shell when you interact with a container
# (we wouldn't want any boring `sh` now would we?)
# Please feel free to set up your own ZSH config in here!
# It gets mapped to your `.zshrc` for the root user in the container
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Source Antigen
source ~/.antigen/antigen.zsh
autoload -U colors && colors
setopt promptsubst
# Set up oh-my-zsh
antigen use oh-my-zsh
# Set up plugins
antigen bundle git
antigen bundle docker
# Set up our preferred theme
antigen theme cloud
# Run all that config
antigen apply
# Set up Ctrl + Backspace and Ctrl + Del so you can move around and backspace faster (try it!)
bindkey '^H' backward-kill-word
bindkey -M emacs '^[[3;5~' kill-word
# Set up aliases
alias cl="clear"
alias x="exit"
@arctic-hen7
Copy link
Author

Use this starter Dockerfile to install ZSH and set everything up for you, using this config.

@Ethan0429
Copy link

I am so confused with this.

  1. Why is this a .sh file? It looks like just a plain .zshrc file.
  2. How does COPY <src> <dst> access this file and copy it to the container path? How does it have access??

@arctic-hen7
Copy link
Author

It is a .zshrc file, just one that you'd put inside the root of your project, which allows the Dockerfile's COPY instruction to access it. I've just labelled it a .sh file for uniformity, you could easily call it something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment