From 48defcfa456bccd99a98f12286956aa75c6ec790 Mon Sep 17 00:00:00 2001 From: Guiillaume Hemmen <guillaume@van-hemmen.com> Date: Wed, 25 Jun 2025 17:20:50 +0000 Subject: [PATCH] #0000 - Add global gitignore configuration in Dockerfile for improved developer experience. --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a260d6d..b687763 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \