Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Improve developer experience with git worktree and docker environment. #206

Conversation

connorgmeehan
Copy link
Collaborator

@connorgmeehan connorgmeehan commented Oct 29, 2021

Doom Contrib Docker Image ./start_docker.sh

This docker image aids in development by setting up a docker virtual environment and git worktree of doom-nvim to make your changes within.

How to use

The setup and start process is handled in the ./start_docker.sh script.

Bootstraps a docker image for contributing changes to doom-nvim

Syntax: ./start_docker.sh [-b <branc_name>]
options:
-b     Create a new branch for the contribution (default is doom-nvim-contrib)
-h     Shows this help menu

What this script does

  1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history.
    • This worktree will be placed in the docker/doom-nvim-contrib folder inside of this repository.
    • Because they share history you wont be able to checkout the same branch on both copies of the repository. Unless specified, a new branch called doom-nvim-contrib will be created off the latest version of develop.
  2. It will setup a new docker image to run this config within (if necessary).
  3. It will then start the docker image and enter you into neovim.

Generated Folders

These are the folders used by this docker image, they will be auto generated when ./start_docker.sh is run

contribute/doom-nvim-contrib/ - Git worktree for doom-nvim contributions
contribute/local-share-nvim/ - Stores the data from ~/.local/share/nvim/
contribute/workspace/ - Directory to store test files and project that you want to test your changes upon

@NTBBloodbath NTBBloodbath added the scope: enhancement New feature or request label Oct 30, 2021
@NTBBloodbath
Copy link
Collaborator

Hi mate, thank you so much per doing this. I'm loving all the new stuff and documentations, I'm pretty sure that this is going to be really useful :)

Sadly I cannot give it a try at the moment because my net has been pretty much trash this month lol, however I think everything looks pretty good.

Just a small request before merging, can you please create a link to the contribute directory in the docs/contributing.md file? This could help improving discoverability of this new tool and I also think this should be referenced in that file too lol.

Cheers :)

contribute/start_docker.sh Show resolved Hide resolved
contribute/start_docker.sh Outdated Show resolved Hide resolved
contribute/start_docker.sh Outdated Show resolved Hide resolved
contribute/start_docker.sh Show resolved Hide resolved
contribute/start_docker.sh Outdated Show resolved Hide resolved
contribute/start_docker.sh Outdated Show resolved Hide resolved
contribute/start_docker.sh Outdated Show resolved Hide resolved
@connorgmeehan
Copy link
Collaborator Author

Hey cheers for the feedback @06kellyjac, I really need to get my linters set up. I ran this through shellcheck and made those changes as well.

@connorgmeehan
Copy link
Collaborator Author

Just added the documentation to contributing.md :) @NTBBloodbath I've retested everything and it's working for me. Would be good to get a second opinion on this as well.

@connorgmeehan connorgmeehan force-pushed the feature/add-development-docker-image branch from 0ec7a5f to 113cb34 Compare October 31, 2021 09:51
@NTBBloodbath
Copy link
Collaborator

Hey, thanks buddy :)

Everything looks good to me, just a small question now that I see this, why are we downloading packer in the docker image? I mean, Doom automatically downloads it if needed and then loads it but wanted to know if there was a specific reason for this :p

I'm going to try to give this a try before merging (my net is really poor nowadays, thinking about getting a new one lol) but as I told this looks pretty fine to me (also thanks to @06kellyjac for the feedback :) ).

@connorgmeehan
Copy link
Collaborator Author

connorgmeehan commented Nov 1, 2021

Ahhh I didn't know this. I haven't setup doom-nvim from scratch before. I'll test out removing the packer install from the Dockerfile after work today. Thanks for the feedback!

I might also try joining all the pacman installs and deleting cache to reduce the image size, right now it's ~900MB.

@connorgmeehan
Copy link
Collaborator Author

connorgmeehan commented Nov 1, 2021

Hi, are we ready to go and merge this? :)

@molleweide
Copy link
Contributor

Could you guys explain to a docker noob the imagined use scenario with this? How should I use this?

@connorgmeehan
Copy link
Collaborator Author

@molleweide The use case is creating a copy of the doom-nvim repo so that you can make changes without effecting your current config. It uses a git worktree which is like having the same repo in two places so this lets you cherrypick bug fixes into your own configuration.

How to use it is run ./start_docker.sh to set everything up. Once that's done a new neovim instance will be running in that terminal. You will be able to make changes by editing files within ~/.config/nvim/contribute/doom-nvim-contrib. It just keeps things seperate so you're not jumping between branches and losing your custom config when making fixes/improvements.

@molleweide
Copy link
Contributor

I have to try this!!

What word do I type to test/use this new nvim instance?

@connorgmeehan
Copy link
Collaborator Author

Right now you have to run it from the terminal (I've spoken to @NTBBloodbath about adding a :DoomContribute command down the line). Once it's merged you will be able to cd into ~/.config/nvim/contribute and run ./start_docker.sh and the new doom-nvim instance will automatically start. It will take a while the first time you run it to set everything up but once that's done it's pretty quick :).

If you want to test this out:
You can clone my PR branch into a temporary folder (don't worry about replacing ~/.config/nvim, you probably don't want to replace your config with my repository).
git clone https://github.com/connorgmeehan/doom-nvim.git --branch feature/add-development-docker-image
cd doom-nvim/contribute
start_docker.sh
Just make sure that you have docker installed.

@NTBBloodbath NTBBloodbath merged commit 57758dc into doom-neovim:develop Nov 4, 2021
@molleweide
Copy link
Contributor

molleweide commented Dec 21, 2021

@connorgmeehan, when I run the docker start script I get this message:

 > [internal] load metadata for docker.io/library/archlinux:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:f1f68e8797f360754b8c7cc582168b5b5b77ff7eb6fb4760e4a82e8b5a10aab0: not found
 - Success! Running docker container doom-nvim-contrib-container...

Unable to find image 'doom-nvim-contrib:latest' locally
docker: Error response from daemon: pull access denied for doom-nvim-contrib, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

Does this mean one is required to have a docker hub account in order to run the docker img?
Or do you think this is a macos issue?

@connorgmeehan
Copy link
Collaborator Author

connorgmeehan commented Dec 21, 2021

No you shouldn't need a docker hub account, I think that this is the main error.

failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:f1f68e8797f360754b8c7cc582168b5b5b77ff7eb6fb4760e4a82e8b5a10aab0: not found

Hmmm, do you have an M1 Macbook? Maybe something going on there with arm binaries. I'll look into this tomorrow.

@molleweide
Copy link
Contributor

Cool! Yes I am using M1.

@06kellyjac
Copy link

Yeah I guess the archlinux the base image doesnt have an aarch64 arm image so you cant build the image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants