From aca4bb68527c318eebb32a96e26885c993c695d3 Mon Sep 17 00:00:00 2001 From: Derek Lewis Date: Thu, 1 Feb 2024 21:40:09 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=E2=9C=A8=EF=BC=9Akick=20off=20new?= =?UTF-8?q?=20fish=20shell=20CentOS=20devcontainer=20#28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/OpenINF/docker-fisher/issues/16 PR URL: https://github.com/OpenINF/docker-fisher/pull/28 Reviewed-by: OpenINF Bot <132791922+openinfbot@users.noreply.github.com> Signed-off-by: Derek Lewis Cc: Princess Irulen Cc: Jorge Bucaran --- .devcontainer.json | 22 ------ .dockerignore => .devcontainer/.dockerignore | 0 .devcontainer/Dockerfile | 23 ++++++ .devcontainer/devcontainer.json | 10 +++ .devcontainer/docker-compose.yml | 26 +++++++ .devcontainer/post-create.fish | 76 ++++++++++++++++++++ .github/dependabot.yml | 12 ++++ AUTHORS | 6 ++ 8 files changed, 153 insertions(+), 22 deletions(-) delete mode 100644 .devcontainer.json rename .dockerignore => .devcontainer/.dockerignore (100%) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml create mode 100644 .devcontainer/post-create.fish create mode 100644 .github/dependabot.yml create mode 100644 AUTHORS diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index 9d96bd64..00000000 --- a/.devcontainer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18", - "remoteUser": "node", - "customizations": { - "vscode": { - "extensions": [ - "mads-hartmann.bash-ide-vscode", - "bmalehorn.vscode-fish", - "timonwong.shellcheck", - "streetsidesoftware.code-spell-checker", - "ms-azuretools.vscode-docker" - ] - } - }, - "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {} - }, - "postCreateCommand": "npm install -g @devcontainers/cli && sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y shellcheck", - "hostRequirements": { - "cpus": 4 - } -} diff --git a/.dockerignore b/.devcontainer/.dockerignore similarity index 100% rename from .dockerignore rename to .devcontainer/.dockerignore diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..6509c803 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,23 @@ +# Ethically sourced from official fish-shell/fish-shell project: +# See: https://github.com/fish-shell/fish-shell/blob/HEAD/Dockerfile + +FROM centos:centos7 + +# Build dependency # skipcq: DOK-W1003 +RUN yum update -y \ + && yum install -y epel-release \ + && yum install -y clang cmake3 gcc-c++ make ncurses-devel \ + && yum clean all + +# Test dependency # skipcq: DOK-W1003 +RUN yum install -y expect vim-common \ + && yum clean all + +# ADD . /src +# WORKDIR /src + +# Build fish +# RUN cmake3 . &&\ +# make &&\ +# make install + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..d5eecd8e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/openinf/docker-fisher/tree/main/templates/centos7 +{ + "name": "CentOS", + + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "Dockerfile" + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000..73ad0bde --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' + +services: + app: + build: + context: . + dockerfile: Dockerfile + + volumes: + # Forwards the local Docker socket to the container. + - /var/run/docker.sock:/var/run/docker-host.sock + # Update this to wherever you want VS Code to mount the folder of your project + - ../..:/workspaces:cached + + # Overrides default command so things don't shut down after the process ends. + entrypoint: /usr/local/share/docker-init.sh + command: sleep infinity + + # Uncomment the next four lines if you will use a ptrace-based debuggers like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) diff --git a/.devcontainer/post-create.fish b/.devcontainer/post-create.fish new file mode 100644 index 00000000..815f1c3f --- /dev/null +++ b/.devcontainer/post-create.fish @@ -0,0 +1,76 @@ +#!/usr/bin/fish + +# If there's a .ruby-version, then run `rbenv install`. +if test -e .ruby-version + rbenv install --verbose +end + +echo 'set -Ux fish_user_paths ~/.rbenv/shims/ $fish_user_paths' >> ~/.config/fish/config.fish + +# To squelch yellow message re: specifying how divergent branches be reconciled. +echo 'git config pull.rebase true' >> ~/.config/fish/config.fish # rebase + +source ~/.config/fish/config.fish + +rbenv rehash + +# If there's a Gemfile, then install Bundler and run `bundle install`. +if test -e Gemfile + # Install Bundler. + gem install bundler + # Configure Bundler setting local gem install path to avoid permission errors. + bundle config set --local path vendor/bundle + # Install the dependencies specified in the Gemfile. + bundle install + # Ensure latest versions of Bundler's dependencies are installed. + bundle update --bundler +else + # If there's no Gemfile, install Jekyll. + gem install jekyll +end + +# If there's a `.nvmrc`, then run `nvm install`. +if test -e .nvmrc + # Install the specified version of Node.js. + nvm install +end + +# If there's a package.json, then run `pnpm install`. +if test -e package.json + corepack enable + corepack prepare pnpm@latest --activate + pnpm install +end + +echo 'rbenv rehash && nvm use' >> ~/.config/fish/config.fish + +source ~/.config/fish/config.fish + +# this will populate your ~/.gnupg directory with empty keyring files +# it will create the ~/.gnupg directory if it does not already exist (expected) +gpg --list-keys + +# If there's a .gnupg directory, then perform the following setup tasks. +if test -e ~/.gnupg/ + # Configure Git to use `gpg2`. + echo 'git config --global gpg.program gpg2' >> ~/.config/fish/config.fish + + echo 'set -gx GPG_TTY (tty)' >> ~/.config/fish/config.fish + + # To fix the " gpg: WARNING: unsafe permissions on homedir + # '/home/path/to/user/.gnupg' " error, make sure that the .gnupg directory and + # its contents is accessibile by your user. + # chown -R (whoami) ~/.gnupg/ + + # Also correct the permissions and access rights on the directory. + # chmod 600 ~/.gnupg/* + # chmod 700 ~/.gnupg + + echo no-autostart >> ~/.gnupg/gpg.conf + + # Remove an existing Unix-domain socket file for remote port forwarding before + # creating a new one when gpgtunnel connection is made. + # rm ~/.gnupg/S.gpg-agent + + printf '\n%s\n\n\t%s\n\n' 'Enable commit signing:' 'git config --global commit.gpgsign true' +end diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..54059f6c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +# Authors ordered by first contribution. +# For any email changes, please make a mailmap request. +# See: https://git-scm.com/docs/gitmailmap + +Derek Lewis +Princess Irulen