-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/devcontainer #1179
Feature/devcontainer #1179
Conversation
Codecov ReportAll modified lines are covered by tests ✅ see 1 file with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
@kwitsch That looks good 👍 I did some experiments with devcontainers and it worked pretty good.I tried to replace the root user with an unprivileged one, this resulted in permission errors and then I gave up. 🤦 I assume, devcontainer runs as root inside, right? Did you try all commands from the Makefile? I think, we need mkdocs-material for "serve_docs" task. |
I found the Dockerfile from my last try, maybe we can take the mkdocs installation part from it: FROM golang:1-bookworm
ARG USERNAME=blocky-dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# install python package manager
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends pipx
# create non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
ENV PATH="${PATH}:/home/$USERNAME/.local/bin"
# install mkdocs-material
RUN pipx install mkdocs-material --include-deps |
We switched from IntelliJ to VSCode with devcontainers at work which speed up the onboarding process of new members in projects and ensure coherence among the team.
According to my experience this should be done after everything else since the other way around can be tricky. 😅
Yes. Since the devcontainer is your actual environment it should be considered as "long term work in process". I wanted to create a first step to start development again and enhance the devcontainer in future PRs. Sorry I should have clarified it in the description.
No I only tested it with the common development commands: fmt,generate,lint,test,build,docker-build |
Just a side note: I think IntelliJ supports devcontainers in the latest version. I didn't try it, but I'll do it as soon we merged you PR :) |
It didn't during our evaluation trial and even now it supports less features. @0xERR0R if you haven't already used it: you should have a free Copilot license because of your open source contribution |
…cky-dev into feature/devcontainer
@0xERR0R all
I advise using VSCode since most convenience features defined in this devcontainer properbly won't work in IntelliJ(
I have to correct my previous answer, it's actually not. |
I use direnv to get project dependencies automatically and have a local setup for blocky. It doesn't configure your editor for you, but for VSCode you could commit a
If that sounds interesting I can make a PR for you to try it out. |
@ThinkChaos I skimmed over direnv but if I get it correct it's primary usecase are Unix systems. I currently only have Git, VSCode and Docker installed. |
Test with vscode (Arch Linux):
|
Test with Goland 2023.3 (Arch Linux):
|
Runs fine with vscode. IntelliJ/Goland -> as you mentioned, not all features are supported. Is very hungry (system load 15 on i9 CPU). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just minor note regarding the golang version. You can merge it 👍
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04", | ||
"features": { | ||
"ghcr.io/devcontainers/features/go:1": { | ||
"version": "1.21" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try to avoid the fix golang version here, otherwise we need to maintain the current version twice, here and in go.mod. Imho it is better to use the latest 1.x here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry had automerge enabled.
Will open another PR for this.
Since I am currently in the process of switching to devcontainers I defined a first version for blocky.
Current features & configurations:
For everyone who has problems building it:
There is a bug in the current release which is fixed in the prerelease.
Setting the extension version in VSCode to prerelease solves the problem.