2020-11-21 01:52:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set -x
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 14:18:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ctr1=$(buildah from "${1:-fedora}")
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 03:53:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Get all updates and install our minimal httpd server
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 14:18:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								buildah run "$ctr1" -- dnf update -y
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								buildah run "$ctr1" -- dnf install -y lighttpd
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-26 03:46:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								buildah run "$ctr1" -- mkdir /run/lighttpd
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 03:53:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Include some buildtime annotations
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 14:18:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								buildah config --annotation "com.example.build.host=$(uname -n)" "$ctr1"
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 03:53:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Run our server and expose the port
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 14:18:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" "$ctr1"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								buildah config --port 80 "$ctr1"
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 03:53:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								## Commit this container to an image name
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-18 14:18:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								buildah commit "$ctr1" "${2:-$USER/lighttpd}"
							 |