From 78b7208f424ab881c454e6988b64e93a731db05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Fernandes?= Date: Wed, 19 Nov 2025 00:24:08 +0000 Subject: [PATCH] added devops devcontainer and image --- .devcontainer/devops-dev/devcontainer.json | 27 +++++++++ .devcontainer/devops/Dockerfile | 62 +++++++++++++++++++++ .gitea/workflows/devops-image-deploy.yaml | 32 +++++++++++ .gitignore | 2 + README.md | 2 + devops/Dockerfile | 64 ++++++++++++++++++++++ devops/assets/.zshrc | 8 +++ devops/devcontainer.json | 22 ++++++++ 8 files changed, 219 insertions(+) create mode 100644 .devcontainer/devops-dev/devcontainer.json create mode 100644 .devcontainer/devops/Dockerfile create mode 100644 .gitea/workflows/devops-image-deploy.yaml create mode 100644 .gitignore create mode 100644 devops/Dockerfile create mode 100644 devops/assets/.zshrc create mode 100644 devops/devcontainer.json diff --git a/.devcontainer/devops-dev/devcontainer.json b/.devcontainer/devops-dev/devcontainer.json new file mode 100644 index 0000000..bd459d9 --- /dev/null +++ b/.devcontainer/devops-dev/devcontainer.json @@ -0,0 +1,27 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "build": { + "dockerfile": "Dockerfile", + "context": "." + }, + "remoteUser": "vscode", + "name": "devops", + "runArgs": [ + "--hostname=devops" + ], + "customizations": { + "vscode": { + "extensions": [ + "ms-kubernetes-tools.vscode-kubernetes-tools", + "redhat.ansible", + "mtxr.sqltools-driver-mysql", + "stateful.runme", + "yzhang.markdown-all-in-one", + "davidanson.vscode-markdownlint", + "eamodio.gitlens", + "m4ns0ur.base64" + ] + } + } +} diff --git a/.devcontainer/devops/Dockerfile b/.devcontainer/devops/Dockerfile new file mode 100644 index 0000000..27aa8a0 --- /dev/null +++ b/.devcontainer/devops/Dockerfile @@ -0,0 +1,62 @@ +FROM mcr.microsoft.com/devcontainers/base:jammy + + +ENV DEBIAN_FRONTEND=noninteractive + +# Base packages +RUN apt-get update && apt-get install -y \ + curl \ + wget \ + git \ + python3 \ + python3-pip \ + jq \ + ca-certificates \ + software-properties-common \ + ansible \ + rclone \ + rsync \ + && rm -rf /var/lib/apt/lists/* + + + +# --- Install kubectl --- +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ + && install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \ + && rm kubectl + +# --- Install Helm --- +RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + +# --- 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 chroma for zsh +RUN 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.tar.gz -i - \ + && tar -xzf /tmp/chroma.tar.gz -C /usr/local/bin \ + && chmod +x /usr/local/bin/chroma \ + + # --- Install act (GitHub Actions local runner) --- +RUN curl -s https://api.github.com/repos/nektos/act/releases/latest \ + | grep "browser_download_url.*linux-amd64.*tar.gz" \ + | cut -d '"' -f 4 \ + | wget -O /usr/local/bin/act -i - \ + && chmod +x /usr/local/bin/act + + +# --- set zsh shell --- +RUN chsh -s /usr/bin/zsh vscode + +RUN git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git /home/vscode/.oh-my-zsh/custom/plugins/fast-syntax-highlighting +RUN git clone https://github.com/zsh-users/zsh-autosuggestions /home/vscode/.oh-my-zsh/custom/plugins/zsh-autosuggestions + +COPY ./assets/.zshrc /home/vscode + +# ACT_RUNNER_VERSION=0.2.13 +# curl -sSL https://dl.gitea.com/act_runner/${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64 \ +# -o /usr/local/bin/act_runner +# chmod +x /usr/local/bin/act_runner \ No newline at end of file diff --git a/.gitea/workflows/devops-image-deploy.yaml b/.gitea/workflows/devops-image-deploy.yaml new file mode 100644 index 0000000..6db01e7 --- /dev/null +++ b/.gitea/workflows/devops-image-deploy.yaml @@ -0,0 +1,32 @@ +on: + push: + branches: + - main + schedule: + - cron: '@weekly' # once per week + +jobs: + + build-docker-image: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to git.limbosolutions.com docker registry + uses: docker/login-action@v3 + with: + registry: git.limbosolutions.com + username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }} + + - name: Build and push Docker images + id: push + uses: docker/build-push-action@v6 + with: + context: ${{gitea.workspace}}/devops + file: ${{gitea.workspace}}/devops/Dockerfile + push: true + tags: git.limbosolutions.com/mylimbo/devcontainers/devops:latest \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2f55bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.devcontainer/devops-dev/assets +.devcontainer/devops-dev/Dockerfile diff --git a/README.md b/README.md index 828f605..c5a97cf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # devcontainers + + diff --git a/devops/Dockerfile b/devops/Dockerfile new file mode 100644 index 0000000..7beff25 --- /dev/null +++ b/devops/Dockerfile @@ -0,0 +1,64 @@ +FROM mcr.microsoft.com/devcontainers/base:jammy + + +ENV DEBIAN_FRONTEND=noninteractive + +# Base packages +RUN apt-get update && apt-get install -y \ + curl \ + wget \ + git \ + python3 \ + python3-pip \ + jq \ + ca-certificates \ + software-properties-common \ + ansible \ + rclone \ + rsync \ + && rm -rf /var/lib/apt/lists/* + + + +# --- Install kubectl --- +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ + && install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \ + && rm kubectl + +# --- Install Helm --- +RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + +# --- 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 chroma for zsh +RUN 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.tar.gz -i - \ + && tar -xzf /tmp/chroma.tar.gz -C /usr/local/bin \ + && chmod +x /usr/local/bin/chroma \ + + + +# --- Install act (GitHub Actions local runner) --- +RUN curl -s https://api.github.com/repos/nektos/act/releases/latest \ + | grep "browser_download_url.*linux-amd64.*tar.gz" \ + | cut -d '"' -f 4 \ + | wget -O /usr/local/bin/act -i - \ + && chmod +x /usr/local/bin/act + + +# --- set zsh shell --- +RUN chsh -s /usr/bin/zsh vscode + +RUN git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git /home/vscode/.oh-my-zsh/custom/plugins/fast-syntax-highlighting +RUN git clone https://github.com/zsh-users/zsh-autosuggestions /home/vscode/.oh-my-zsh/custom/plugins/zsh-autosuggestions + +COPY ./assets/.zshrc /home/vscode + +# ACT_RUNNER_VERSION=0.2.13 +# curl -sSL https://dl.gitea.com/act_runner/${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64 \ +# -o /usr/local/bin/act_runner +# chmod +x /usr/local/bin/act_runner \ No newline at end of file diff --git a/devops/assets/.zshrc b/devops/assets/.zshrc new file mode 100644 index 0000000..188fe0d --- /dev/null +++ b/devops/assets/.zshrc @@ -0,0 +1,8 @@ +export ZSH="$HOME/.oh-my-zsh" +DISABLE_AUTO_UPDATE=true +DISABLE_UPDATE_PROMPT=true +ZSH_COLORIZE_TOOL=chroma +export FAST_HIGHLIGHT_CHROMA=1 +ZSH_THEME="gnzh" +plugins=(git timer web-search ssh kubectl helm colorize zsh-autosuggestions fast-syntax-highlighting) +source $ZSH/oh-my-zsh.sh diff --git a/devops/devcontainer.json b/devops/devcontainer.json new file mode 100644 index 0000000..7e8a179 --- /dev/null +++ b/devops/devcontainer.json @@ -0,0 +1,22 @@ +{ + "image": "https://gitlimbosolutions.com/mf/devcontainers/devops", + "remoteUser": "vscode", + "name": "devops", + "runArgs": [ + "--hostname=devops" + ], + "customizations": { + "vscode": { + "extensions": [ + "ms-kubernetes-tools.vscode-kubernetes-tools", + "redhat.ansible", + "mtxr.sqltools-driver-mysql", + "stateful.runme", + "yzhang.markdown-all-in-one", + "davidanson.vscode-markdownlint", + "eamodio.gitlens", + "m4ns0ur.base64" + ] + } + } +}