🐳 Use docker to test locally
This commit is contained in:
		
					parent
					
						
							
								a09bcfbe95
							
						
					
				
			
			
				commit
				
					
						1be0d5fb44
					
				
			
		
					 2 changed files with 20 additions and 5 deletions
				
			
		
							
								
								
									
										7
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | FROM ruby:2.6.3 | ||||||
|  | 
 | ||||||
|  | RUN gem install bundler:2.0.2 && \ | ||||||
|  |     bundle config --global frozen 1 | ||||||
|  | 
 | ||||||
|  | COPY Gemfile Gemfile.lock ./ | ||||||
|  | RUN bundle install | ||||||
							
								
								
									
										18
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -1,11 +1,19 @@ | ||||||
|  | .PHONY: all build-image serve clean | ||||||
|  | 
 | ||||||
| export PATH := $(HOME)/bin:$(PATH):/usr/local/bin | export PATH := $(HOME)/bin:$(PATH):/usr/local/bin | ||||||
| IP ?= 127.0.0.1 |  | ||||||
| PORT ?= 4000 | PORT ?= 4000 | ||||||
|  | IMAGE=ruby-with-bundler:2.6.3-2.0.2 | ||||||
| 
 | 
 | ||||||
| all: serve | all: serve | ||||||
| 
 | 
 | ||||||
| stage: | build-image: | ||||||
| 	bundle exec jekyll build -c '_config.yml,_config.local.yml' | 	docker build -t $(IMAGE) . | ||||||
| 
 | 
 | ||||||
| serve: | _site/index.html: build-image | ||||||
| 	bundle exec jekyll serve -H "$(IP)" -P "$(PORT)" -c '_config.yml,_config.local.yml' | 	docker run -u $(shell id -u) --rm -v $(shell pwd):/app -w /app $(IMAGE) bundle exec jekyll build -c '_config.yml,_config.local.yml' | ||||||
|  | 
 | ||||||
|  | serve: _site/index.html | ||||||
|  | 	docker run --rm -it -v $(shell pwd):/app -w /app -p $(PORT):$(PORT) $(IMAGE) bundle exec jekyll serve -H 0.0.0.0 -P "$(PORT)" -c '_config.yml,_config.local.yml' | ||||||
|  | 
 | ||||||
|  | clean: | ||||||
|  | 	rm -rf _site | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue