Giter Site home page Giter Site logo

workshop-msano / sampletodo Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 19 KB

A template for novice Docker developers showing how Docker can be applied to development.🐳

Home Page: https://qiita.com/miku0129/items/e9d7276a1c3bda56d1df

Python 55.53% HTML 22.13% Dockerfile 22.33%
docker python3 remote-development

sampletodo's Introduction

Overview

Install git inside a container and establish remote connection using VSCode. Incorporating Docker containers into actual development has become easier for development and version control purposes. I have shared the knowledge gained from creating this application in a Qiita post.

Demo

Tools Used

In my environment, I have installed Docker on Ubuntu. It is assumed that you can connect to GitHub via SSH using VSCode.

__β€» I received a report from someone who helped with the verification process that Rootless Mode is required to use Docker with VSCode. __ I will update with additional information if available.

Tool Version Remarks
Docker 20.10.21
docker-compose 1.29.2
Dev Containers 0.266.1 VSCode extension

Folder Structure

root/
  β”œ .devcontainer/
  β”‚  β”” devcontainer.json
  β”œ templates/
  β”‚  β”” index.html
  β”œ .dockerignore
  β”œ Dockerfileγ€€
  β”œ docker-compose.yml
  β”œ .gitignore
  β”œ app.py
  β”” requirements.txt

Flow from Cloning the Template to Setting Up the Development Environment

β€» The installation of each tool has been completed.

  1. Clone the SampleTodo repository from this repository.

    git clone [email protected]:workshop-msano/sampleTodo.git
    
  2. Open the files in VSCode. Press the Remote Container start button at the bottom left of VSCode.


2022-12-10-104132


  1. Select Open Folder in Container from the popup window in VSCode.

2022-12-10-104902




  1. Click Open in the popup window.

2022-12-10-105428


  1. After a while, VSCode will be displayed. If Dev Container is displayed next to the Remote Development button at the bottom left, it means it was successful!
    γ€€

2022-12-10-105935


  1. You can access the web app from http://localhost:8000.


<p>2022-12-10-214935" border="0" width=400>
<br></p>
<ol start=

  • Since git is already installed in the container, configure it to access GitHub from the container. Open the terminal and run the following commands.
    It is assumed that you can connect to GitHub via SSH using VSCode.

    git config --global user.email '<your setting>'
    git config --global user.name '<Your setting>'
    
    mkdir -p ~/.ssh/
    curl -s -o ~/.ssh/id_ed25519 "https://github.com/$(git config --global --get user.name).keys"
    
  • Next, enter ssh -v [email protected] in the terminal.
    If there is a successful access to GitHub displayed in the log, it is complete! You can create a repository on GitHub and manage the source code version from within the Docker container.



  • Bonus

    Let's use a shell script to access the database in the Docker container. Execute the following commands outside the container.

    docker exec -it sampletodo_db /bin/sh
    
    psql --username postgres
    

    Well done! πŸŽ‰πŸŽ‰πŸŽ‰

    sampletodo's People

    Contributors

    miku0129 avatar

    Stargazers

     avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❀️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.