2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# VM setup - Create docker image
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-02 16:14:11 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								## Install git, Node.js and yarn
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- `sudo apt-get update`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- `sudo apt-get install -y git`
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-08 15:44:47 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- Install the latest stable version of [Node.js](https://nodejs.org/en/download).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- Install the latest stable version of [yarn](https://classic.yarnpkg.com/en/docs/install).
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-09 18:54:53 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Checkout repository
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- `git clone <repo-url>`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Build docker image
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-17 17:08:16 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								- `<aio-builds-setup-dir>/scripts/create-image.sh [<name>[:<tag>] [--build-arg <NAME>=<value> ...]]`
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- You can overwrite the default environment variables inside the image, by passing new values using
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  `--build-arg`.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-08 15:44:47 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								**Note 1:** The script has to execute docker commands with `sudo`.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								**Note 2:**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								The script has to execute `yarn` commands, so make sure `yarn` is on the `PATH` when invoking the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								script.
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Example
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								The following commands would create a docker image from GitHub repo `foo/bar` to be deployed on the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`foobar-builds.io` domain and accepting PR deployments from authors that are members of the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`bar-core` and `bar-docs-authors` teams of organization `foo`:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- `git clone https://github.com/foo/bar.git foobar`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								- Run:
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-02 16:14:11 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ```sh
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-15 21:29:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    --build-arg AIO_REPO_SLUG=foo/bar \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    --build-arg AIO_DOMAIN_NAME=foobar-builds.io \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    --build-arg AIO_GITHUB_ORGANIZATION=foo \
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-19 01:15:07 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    --build-arg AIO_GITHUB_TEAM_SLUGS=bar-core,bar-docs-authors
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-09 22:12:01 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ```
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								A full list of the available environment variables can be found
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[here](image-config--environment-variables.md).
							 |