From e489fcb76a477984f02d41a426dda9b4548a9371 Mon Sep 17 00:00:00 2001 From: Stanislaw Malinowski Date: Tue, 11 Nov 2025 13:18:41 +0000 Subject: [PATCH 1/2] initial devcontainer setup --- .devcontainer/devcontainer.json | 46 +++++++++++++++++++++++++++++++++ Dockerfile | 14 ++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c50eb1c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,46 @@ +{ + "containerEnv": { + "TZ": "" + }, + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "build": { + "dockerfile": "../Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "bajdzis.vscode-database", // Supports connections to mysql or postgres, over SSL, socked + "davidanson.vscode-markdownlint", // Markdown linting + "eamodio.gitlens", // IDE Git information + "github.copilot", // AI code completion + "github.vscode-pull-request-github", // Github interaction + "golang.go", // Go language support + "Gruntfuggly.todo-tree", // Highlights TODO comments + "IBM.output-colorizer", // Colorize your output/test logs + "mohsen1.prettify-json", // Prettify JSON data + "ms-azuretools.vscode-docker", // Docker integration and linting + "nefrob.vscode-just-syntax", // Justfile syntax highlighting + "quicktype.quicktype", // Paste JSON as code + "redhat.vscode-yaml", // Kubernetes, Drone syntax highlighting + "shardulm94.trailing-spaces", // Show trailing spaces + "stkb.rewrap", // rewrap comments after n characters on one line + "vscode-icons-team.vscode-icons" // Better file extension icons + ] + } + }, + "forwardPorts": [ + 3000 + ], + "initializeCommand": "bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'", + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind", + "source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind", + // Docker socket to access the host Docker server + { + "source": "/var/run/docker.sock", + "target": "/var/run/docker.sock", + "type": "bind" + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ef8468b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/golang:1.24.9-trixie +# install dependencies +RUN apt-get update && \ + apt-get install -y \ + build-essential \ + zsh \ + && rm -rf /var/lib/apt/lists/* +# install just +RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin +# setup zsh and oh-my-zsh +RUN git clone --single-branch --depth 1 https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +RUN cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +RUN chsh -s /bin/zsh +CMD [ "/bin/zsh" ] \ No newline at end of file From 5d5ac4f1bf8344db7889fc3d06fc52393d36cc1e Mon Sep 17 00:00:00 2001 From: Stanislaw Malinowski Date: Tue, 11 Nov 2025 13:43:55 +0000 Subject: [PATCH 2/2] install pants inside devcontainer and add postcreatecommand --- .devcontainer/devcontainer.json | 3 ++- Dockerfile | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c50eb1c..05b4339 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -42,5 +42,6 @@ "target": "/var/run/docker.sock", "type": "bind" } - ] + ], + "postCreateCommand": "pants run cmd/greeter_en" } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ef8468b..83281b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,11 @@ RUN apt-get update && \ zsh \ && rm -rf /var/lib/apt/lists/* # install just -RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin -# setup zsh and oh-my-zsh -RUN git clone --single-branch --depth 1 https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh -RUN cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc -RUN chsh -s /bin/zsh +# install Pants +COPY get-pants.sh /tmp/get-pants.sh +RUN bash /tmp/get-pants.sh --bin-dir /usr/local/bin && \ + export PATH="/usr/local/bin:$PATH" && \ + git clone --single-branch --depth 1 https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh && \ + cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc && \ + chsh -s /bin/zsh CMD [ "/bin/zsh" ] \ No newline at end of file