Skip to content

Instantly share code, notes, and snippets.

@kuanyui
Last active May 15, 2024 12:31
Show Gist options
  • Save kuanyui/e03195f0326a8e2bd4f1ec828fc84ae5 to your computer and use it in GitHub Desktop.
Save kuanyui/e03195f0326a8e2bd4f1ec828fc84ae5 to your computer and use it in GitHub Desktop.
(NOTE: Please place all the files under ./container)
# ===== USAGE =====
# clear; export BUILDAH_LAYERS=false; podman build --tag resume ./container
#
# podman run --name resume --detach --tty \
# --publish 58000:8000/tcp \
# --userns=keep-id:uid=1000,gid=1000 \
# --volume /home/${USER}/${HOST_PROJ_DIR}:/home/user/MY_PROJECT \
# localhost/resume
#
# podman exec --interactive --tty --workdir /home/user/MY_PROJECT --user user resume /bin/bash
# =================
FROM debian:bookworm
SHELL ["/bin/bash", "-c"]
EXPOSE 8001/tcp
# Some basic packages
RUN apt-get update && \
apt-get install --yes --no-install-recommends ca-certificates iputils-ping less curl wget make git mg graphicsmagick libfontconfig1 libharfbuzz0b libfribidi0 wkhtmltopdf inotify-tools fonts-noto-cjk-extra && \
useradd --create-home --shell /bin/bash user
COPY --chown=root ./root_bashrc /root/.bashrc
COPY --chown=user ./user_bashrc /home/user/.bashrc
USER user
# https://github.com/nvm-sh/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash || true
RUN /bin/bash -c "source ~/.bashrc && nvm install v14.20.0"
# Don't install `imagemagick` via `apt`, because Debian 12/Ubuntu 23.10 are
# still providing `imagemagick 6.9` released in 2016, which is lacks of `magick`
# commands available since 7.x. We will install official AppImage binary of
# `imagemagick` from Github https://github.com/ImageMagick/ImageMagick/releases
#
# . https://github.com/ImageMagick/ImageMagick/releases
RUN cd && mkdir appimages && \
wget --output-document "ImageMagick.AppImage" "https://github.com/ImageMagick/ImageMagick/releases/download/7.1.1-29/ImageMagick--gcc-x86_64.AppImage" && \
chmod +x ./ImageMagick.AppImage && \
./ImageMagick.AppImage --appimage-extract && \
mv squashfs-root imagemagick
RUN cd && mkdir MY_PROJECT && cd MY_PROJECT
WORKDIR MY_PROJECT
# This is the ~/.bashrc inside the container
PS1='\[\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\W\[\e[1;33m\]\$\[\e[m\] '
alias sz="source ~/.bashrc"
alias ll='ls -al --color=auto '
alias ls='ls --color=auto '
alias sc="systemctl"
alias jc="journalctl"
alias jc-clear="journalctl --vacuum-time=5d" # Delete journal logs which are older than 5 days
alias nvv='nvm ls'
alias nv='nvm version'
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ......='cd ../../../../../'
export HISTCONTROL=ignorespace
# This is the ~/.bashrc inside the container
PS1='\[\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\W\[\e[1;33m\]\$\[\e[m\] '
alias sz="source ~/.bashrc"
alias ll='ls -al --color=auto '
alias ls='ls --color=auto '
alias sc="sudo systemctl"
alias jc="sudo journalctl"
alias jc-clear="sudo journalctl --vacuum-time=5d" # Delete journal logs which are older than 5 days
alias nvv='nvm ls'
alias nv='nvm version'
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ......='cd ../../../../../'
export HISTCONTROL=ignorespace
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
PATH=/home/user/appimages/imagemagick/usr/bin/:${PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment