Last active
          September 27, 2021 01:33 
        
      - 
      
- 
        Save PercyODI/cd2034e59c5de234c3baabf489536522 to your computer and use it in GitHub Desktop. 
Revisions
- 
        PercyODI revised this gist Sep 27, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Build and run development container: ```console sudo podman build -t devenv:latest -f ./.devenv/Dockerfile --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . sudo podman run -dit -p 2278:22 -v ./:/usr/dev --name devenv devenv:latest ``` Then connect using Visual Studo Code 
- 
        PercyODI created this gist Sep 27, 2021 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ FROM ubuntu:bionic ARG USER_ID=1000 ARG GROUP_ID=1000 RUN apt update -y \ && apt install openssh-server sudo curl -y # Download and install Go WORKDIR /tmp RUN curl -O https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz RUN tar -C /usr/local -xvzf go1.17.1.linux-amd64.tar.gz RUN PATH=$PATH:/usr/local/go/bin \ && echo "export PATH=$PATH" > /etc/environment # Create dev user and src directory RUN groupadd -g ${GROUP_ID} devgroup RUN useradd -l -u ${USER_ID} --create-home -s /bin/bash -g devgroup -G sudo dev RUN echo 'dev:dev' | chpasswd # Start SSH Service EXPOSE 22 RUN service ssh start CMD ["/usr/sbin/sshd","-D"] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ # Dev Environment Testing This is for building a development environment using Podman in WSL2 and connecting it with VS Code. This particular dev environment installs Go. Could be generalized, and used as a base image for more specific dev environments. ## Setup Build and run development container: ```console sudo podman build -t devenv:latest -f ./.devenv/Dockerfile --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=$(id -g ${USER}) . sudo podman run -dit -p 2278:22 -v ./:/usr/dev:z --name devenv --user $UID devenv:latest ``` Then connect using Visual Studo Code Remote-SSH: Connect to Host Configure new host ssh dev@localhost -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2278 devcontainer ## Resources - https://jtreminio.com/blog/running-docker-containers-as-current-host-user/