From d296afe98f925f543b5ef69b5051b9966636bf2a Mon Sep 17 00:00:00 2001 From: Tomas Mirchev Date: Sun, 30 Mar 2025 03:20:01 +0200 Subject: [PATCH] ubuntu: new image --- base-ubuntu/Dockerfile | 39 ++++++++++++++++++++++++ base-ubuntu/install-packages.sh | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 base-ubuntu/Dockerfile create mode 100644 base-ubuntu/install-packages.sh diff --git a/base-ubuntu/Dockerfile b/base-ubuntu/Dockerfile new file mode 100644 index 0000000..7ed54aa --- /dev/null +++ b/base-ubuntu/Dockerfile @@ -0,0 +1,39 @@ +ARG VARIANT="plucky" +FROM ubuntu:${VARIANT} + +ENV TERM=xterm-256color +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \ + # basics + git wget locales ca-certificates sudo openssh-client libssl-dev \ + # utils + tree jq \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Set up UTF-8 locale +RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LC_ALL=en_US.UTF-8 +ENV LC_CTYPE=en_US.UTF-8 + +ARG WORKSPACE_DIR="/workspace" +ARG USERNAME=dev +ARG UID=1000 +ARG GID=1000 + +RUN groupadd -g ${GID} ${USERNAME} \ + && useradd -u ${UID} -g ${GID} -m -s /bin/zsh ${USERNAME} \ + && echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +RUN mkdir -p ${WORKSPACE_DIR} && chown ${USERNAME}:${USERNAME} ${WORKSPACE_DIR} +WORKDIR ${WORKSPACE_DIR} + +USER ${USERNAME} + +COPY install-packages.sh /tmp/install-packages.sh +RUN sudo chmod +x /tmp/install-packages.sh && /tmp/install-packages.sh && sudo rm /tmp/install-packages.sh + +CMD ["zsh"] diff --git a/base-ubuntu/install-packages.sh b/base-ubuntu/install-packages.sh new file mode 100644 index 0000000..55c2f31 --- /dev/null +++ b/base-ubuntu/install-packages.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +sudo apt-get update && sudo apt-get install -y --no-install-recommends \ + luarocks curl unzip ripgrep fd-find \ + python3 build-essential + +# Install Tree-sitter and Neovim +ARCH=$(dpkg --print-architecture) +TREE_SITTER_VERSION="0.25.2" +NVIM_VERSION="0.10.4" + +if [[ "$ARCH" == "arm64" ]]; then + TREE_SITTER_URL="https://github.com/tree-sitter/tree-sitter/releases/download/v${TREE_SITTER_VERSION}/tree-sitter-linux-arm64.gz" + NVIM_URL="https://github.com/neovim/neovim/releases/download/v${NVIM_VERSION}/nvim-linux-arm64.tar.gz" +elif [[ "$ARCH" == "amd64" ]]; then + TREE_SITTER_URL="https://github.com/tree-sitter/tree-sitter/releases/download/v${TREE_SITTER_VERSION}/tree-sitter-linux-x64.gz" + NVIM_URL="https://github.com/neovim/neovim/releases/download/v${NVIM_VERSION}/nvim-linux-x86_64.tar.gz" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +# Download and install Tree-sitter +echo "Installing Tree-sitter..." +wget -O /tmp/tree-sitter.gz "$TREE_SITTER_URL" +gzip -d /tmp/tree-sitter.gz +chmod +x /tmp/tree-sitter +sudo mv /tmp/tree-sitter /usr/local/bin/tree-sitter + +# Download and install Neovim +echo "Installing Neovim..." +wget -O /tmp/nvim.tar.gz "$NVIM_URL" +sudo tar -xzf /tmp/nvim.tar.gz -C /opt +NVIM_DIR=$(find /opt -maxdepth 1 -type d -name "nvim-linux-*") +sudo ln -s "${NVIM_DIR}/bin/nvim" /usr/local/bin/nvim +rm /tmp/nvim.tar.gz + +git clone https://gitea.tomastm.com/tomas.mirchev/dotfiles.git $HOME/.dotfiles +cd $HOME/.dotfiles +echo $(pwd) +echo $(ls -a) +python3 manage.py install linux-dev +python3 manage.py link linux-dev --copy --force + +bash ./scripts/linux-setup_docker.sh + +# Cleanup +rm -rf $HOME/.dotfiles +# sudo apt-get purge -y build-essential python3 +sudo apt-get autoremove -y +sudo apt-get clean -y +sudo rm -rf /var/lib/apt/lists/*