Article list
[First team development ①] Hello, World! With friends
[First team development ②] Build an environment with Docker
[First team development ③] Share the development environment created with Docker (this article)
It is a continuation from Last time. Share the development environment created with Docker to team members through GitHub! This article is for illustration purposes, so the steps are from a team member's perspective.
(Addition) Recently, I feel that the number of people who are new to programming but want to take on the challenge of personal development has increased. So, I added some explanations such as terms and commands for beginners.
-Clone
: Copy the state of files and directories
You can get the URL by visiting the GitHub repository page and clicking the "Code" button. Create a working directory and change to it.
Terminal
$ mkdir project_name
$ cd project_name
・ Mkdir
: Create directory (≒ folder)
・ Cd
: Move to the specified directory
If you copy the URL above and type the following command in the terminal, a folder will be created in your current location.
Terminal
$ git clone https://github.com/xxxx/xxxx.git
Install Docker suitable for the OS from Docker official page. After completing the settings, check the terminal to see if it is installed correctly.
Terminal
$ docker -v
Docker version 19.03.8, build afacb8b
$ docker-compose -v
docker-compose version 1.25.4, build 8d51620a
-v
: Option to check version
Use docker-compose
to start a Docker container.
-Docker-compose
: A convenient tool that allows you to operate multiple containers at the same time. Imagine an octopus manipulating multiple containers with many legs.
Terminal
$cd GitHub repository name#Please move to the cloned folder
$ docker-compose up -d
-Docker-compose up
: Container start command.
--D
: Option to start in the background.
If you can start the container normally,
Access localhost: 3000
→ If "Yay! You're on Rails!" Is displayed, it's OK!
Access localhost: 8080
→ If "Welcome to Your Vue.js + TypeScript App" is displayed, it's OK!
[Other frequently used commands (Docker)]
-$ Docker-compose stop
: Stop the running container
-$ Docker-compose down
: Stop & delete the running container (Restore & start the container with $ docker-compose up -d
again)
-$ Docker-compose ps
: Check the running container
If you are referring to this article from Part 2, there should be two remote branches, main
and develop
.
But locally there is only a main
branch.
So, adjust the status of your local branch to remote.
-Local
: Environment on your PC.
-Remote
: Here, it is a repository on GitHub.
Terminal
$ git branch #Check your current local branch
* main
$ git fetch #Reflect the status of the remote branch locally
$ git branch -a #Check if it is reflected
* main
remotes/origin/HEAD -> origin/main
remotes/origin/develop
remotes/origin/main
$ git checkout develop #Go to develop branch
$ git branch #Confirm that a new develop branch has been created
* develop
main
[Other frequently used commands (Git)]
-$ Git stash
: Temporarily save changes.
Often used when switching branches. If you simply check out, the work content may be reflected halfway in other branches, so as a preventive measure.
-$ Git stash apply
: Reflect the stashed work contents to the current branch.
-$ Git stash drop
: Delete the stashed work contents
・ The road from Git clone to building the environment and participating in the project (all in full) ・ GitHub sharing method for team development beginners -How to build a vue.js development environment on Docker. Easy procedure to create with docker-compose. · Fetch remote branch locally [git fetch] [Sourcetree] -How to use "git stash" to temporarily avoid the contents before commit -Use the [Git] Stash command to temporarily save local changes
Recommended Posts