/ build-push-image (push) Successful in 10m26s
modified: devops/Dockerfile
100 lines
2.8 KiB
Docker
100 lines
2.8 KiB
Docker
FROM ubuntu:latest
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Base packages
|
|
RUN apt-get update && apt-get install -y \
|
|
nano \
|
|
curl \
|
|
wget \
|
|
git \
|
|
sudo \
|
|
python3 \
|
|
python3-venv \
|
|
python3-pip \
|
|
jq \
|
|
ca-certificates \
|
|
software-properties-common \
|
|
rclone \
|
|
rsync \
|
|
iputils-ping \
|
|
dnsutils \
|
|
iproute2 \
|
|
traceroute \
|
|
mtr \
|
|
netcat-openbsd \
|
|
nmap \
|
|
apache2-utils \
|
|
age \
|
|
podman \
|
|
zsh \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# set user with zsh as default shell using default user ubuntu uid
|
|
RUN usermod -l code ubuntu && \
|
|
groupmod -n code ubuntu && \
|
|
usermod -d /home/code -m -s /usr/bin/zsh code && \
|
|
echo "code ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
# Install Oh-My-Zsh for user
|
|
RUN su code -c "curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s -- --unattended"
|
|
|
|
# --- Python virtual environment ---
|
|
RUN python3 -m venv /usr/local/pyenv \
|
|
&& /usr/local/pyenv/bin/pip install --upgrade pip \
|
|
&& /usr/local/pyenv/bin/pip install pyyaml
|
|
# Make virtualenv the default Python
|
|
ENV PATH="/usr/local/pyenv/bin:${PATH}"
|
|
|
|
# --- Install yq ---
|
|
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
|
|
-O /usr/bin/yq && chmod +x /usr/bin/yq
|
|
|
|
#Install docker
|
|
RUN curl -fsSL https://get.docker.com -o get-docker.sh \
|
|
&& sh get-docker.sh \
|
|
&& rm get-docker.sh && \
|
|
usermod -aG docker code
|
|
|
|
|
|
# Install Node.js 22.x
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& npm cache clean --force
|
|
|
|
# ---zsh plugins ---
|
|
RUN su code -c "git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
|
|
/home/code/.oh-my-zsh/custom/plugins/fast-syntax-highlighting"
|
|
|
|
RUN su code -c "git clone https://github.com/zsh-users/zsh-autosuggestions \
|
|
/home/code/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
|
|
|
|
# -- install chroma for zsh
|
|
RUN mkdir /tmp/chroma \
|
|
&& curl -s https://api.github.com/repos/alecthomas/chroma/releases/latest \
|
|
| grep "browser_download_url.*linux-amd64.*tar.gz" \
|
|
| cut -d '"' -f 4 \
|
|
| wget -O /tmp/chroma/chroma.tar.gz -i - \
|
|
&& tar -xzf /tmp/chroma/chroma.tar.gz -C /tmp/chroma \
|
|
&& install -m 0755 /tmp/chroma/chroma /usr/local/bin/chroma \
|
|
&& rm -r /tmp/chroma
|
|
|
|
# --- set zsh shell as default ---
|
|
RUN chsh -s /usr/bin/zsh code
|
|
|
|
# --- copy assets ---
|
|
COPY ./assets/.zshrc /home/code
|
|
|
|
|
|
#----- SOPS
|
|
ENV SOPS_VERSION=3.13.1
|
|
|
|
RUN wget "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64" -O /tmp/sops
|
|
|
|
RUN cp /tmp/sops /usr/local/bin/sops
|
|
RUN chmod +x /usr/local/bin/sops
|
|
RUN mkdir /workspaces && chown code:code /workspaces -R
|
|
USER code
|
|
WORKDIR /workspaces
|
|
|