#0000 - Add global gitignore configuration in Dockerfile for improved developer experience.
This commit is contained in:
parent
e64fcef4be
commit
48defcfa45
1 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ LABEL maintainer="guillaume@van-hemmen.com"
|
||||||
# Build arguments
|
# Build arguments
|
||||||
ARG ARG_TZ="Europe/Paris"
|
ARG ARG_TZ="Europe/Paris"
|
||||||
ARG ARG_NODE_MAJOR=22
|
ARG ARG_NODE_MAJOR=22
|
||||||
|
ARG GITIGNORE_URL="https://www.toptal.com/developers/gitignore/api/linux,jetbrains,visualstudio,visualstudiocode"
|
||||||
|
|
||||||
# System configuration and timezone setup
|
# System configuration and timezone setup
|
||||||
RUN ln -snf /usr/share/zoneinfo/$ARG_TZ /etc/localtime && \
|
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 && \
|
RUN useradd -m -s /bin/bash -G sudo coder && \
|
||||||
echo "coder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/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 && \
|
RUN echo "PS1='🐳 \[\033[1;36m\] \[\033[1;34m\]\W\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'" > /home/coder/.bashrc && \
|
||||||
mkdir -p /workspaces && \
|
mkdir -p /workspaces && \
|
||||||
chown coder:coder /home/coder/.bashrc && \
|
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 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 \
|
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue