- Add global gitignore configuration in Dockerfile for improved developer experience.

This commit is contained in:
Guillaume "B.B." Van Hemmen 2025-06-25 17:20:50 +00:00
parent e64fcef4be
commit 48defcfa45

View file

@ -6,6 +6,7 @@ LABEL maintainer="guillaume@van-hemmen.com"
# Build arguments
ARG ARG_TZ="Europe/Paris"
ARG ARG_NODE_MAJOR=22
ARG GITIGNORE_URL="https://www.toptal.com/developers/gitignore/api/linux,jetbrains,visualstudio,visualstudiocode"
# System configuration and timezone setup
RUN ln -snf /usr/share/zoneinfo/$ARG_TZ /etc/localtime && \
@ -38,11 +39,15 @@ RUN apt-get update && \
RUN useradd -m -s /bin/bash -G sudo coder && \
echo "coder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/coder
# Configure shell environment
# Configure shell environment and git global configuration
RUN echo "PS1='🐳 \[\033[1;36m\] \[\033[1;34m\]\W\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'" > /home/coder/.bashrc && \
mkdir -p /workspaces && \
chown coder:coder /home/coder/.bashrc && \
chown -R coder:coder /workspaces
chown -R coder:coder /workspaces && \
# Set up global gitignore
mkdir -p /home/coder/gitignore && \
curl -sL ${GITIGNORE_URL} -o /home/coder/global.gitignore && \
git config --system core.excludesfile /home/coder/global.gitignore
# Run trivy to scan the system. Exit code is set to 0 as 1 would never allow to pass the scan due to debian known vulns
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \