forked from coolaj86/goldilocks.js
		
	Add initial docker file for quick goldilocks testing
This commit is contained in:
		
							parent
							
								
									7a2f0f0984
								
							
						
					
					
						commit
						3f5ac75e4c
					
				
							
								
								
									
										33
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
# This is for alpine base
 | 
			
		||||
FROM node:alpine
 | 
			
		||||
RUN apk update
 | 
			
		||||
RUN apk upgrade
 | 
			
		||||
RUN apk add curl git libcap htop
 | 
			
		||||
 | 
			
		||||
# This for ubuntu base
 | 
			
		||||
# FROM node
 | 
			
		||||
# RUN apt-get update
 | 
			
		||||
# RUN apt-get dist-upgrade -y
 | 
			
		||||
# RUN apt-get install curl git libcap2 htop -y
 | 
			
		||||
 | 
			
		||||
# Allow node to listen on ports 80 and 443 as normal user.
 | 
			
		||||
RUN setcap cap_net_bind_service=+ep $(readlink -f $(which node))
 | 
			
		||||
 | 
			
		||||
WORKDIR /opt/goldilocks
 | 
			
		||||
 | 
			
		||||
# Copy in just package.json and install npm dependencies first
 | 
			
		||||
COPY package.json /opt/goldilocks/
 | 
			
		||||
RUN yarn install
 | 
			
		||||
 | 
			
		||||
# Then copy in the rest and link as global binary
 | 
			
		||||
COPY . /opt/goldilocks/
 | 
			
		||||
RUN yarn link
 | 
			
		||||
 | 
			
		||||
# Copy in a goldilocks config to test it.
 | 
			
		||||
# TODO: pull this from the user somehow
 | 
			
		||||
COPY etc/goldilocks/goldilocks.example.yml /opt/goldilocks/etc/goldilocks/goldilocks.yml
 | 
			
		||||
 | 
			
		||||
# Run as unpriviledged user
 | 
			
		||||
USER node
 | 
			
		||||
EXPOSE 80 443 5353
 | 
			
		||||
CMD ["/usr/local/bin/goldilocks"]
 | 
			
		||||
							
								
								
									
										17
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
run: build
 | 
			
		||||
	docker run --rm --net=host -d --name goldilocks daplie/goldilocks
 | 
			
		||||
logs:
 | 
			
		||||
	docker logs goldilocks -f
 | 
			
		||||
build:
 | 
			
		||||
	docker build . --tag daplie/goldilocks
 | 
			
		||||
rebuild:
 | 
			
		||||
	docker build . --no-cache --tag daplie/goldilocks
 | 
			
		||||
shell:
 | 
			
		||||
	docker exec -ti goldilocks ash
 | 
			
		||||
htop:
 | 
			
		||||
	docker exec -ti goldilocks htop
 | 
			
		||||
kill:
 | 
			
		||||
	docker kill goldilocks || true
 | 
			
		||||
clean: kill
 | 
			
		||||
	docker rm -f goldilocks || true
 | 
			
		||||
	docker rmi -f daplie/goldilocks || true
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user