Browse Source
			
			
			Merge pull request #2 from mprasil/upstream-vault
			
				Fetch Vault from upstream when building Docker image
			
			
				pull/3/head
			
			
		 
		
			
				
					
						
						Daniel García
					
					8 years ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 3 changed files with 
39 additions and 
1 deletions
			 
			
		 
		
			
				- 
					
					
					 
					Dockerfile
				
 
			
				- 
					
					
					 
					README.md
				
 
			
				- 
					
					
					 
					web-vault/settings.Production.json
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					@ -1,6 +1,33 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Using multistage build:  | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 	https://docs.docker.com/develop/develop-images/multistage-build/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 	https://whitfin.io/speeding-up-rust-docker-builds/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					####################### VAULT BUILD IMAGE  ####################### | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM node:9-alpine as vault | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					ENV VAULT_VERSION "1.26.0" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					ENV URL "https://github.com/bitwarden/web/archive/v${VAULT_VERSION}.tar.gz" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN apk add --update-cache --upgrade \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    curl \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    git \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    tar \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && npm install -g \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        gulp-cli \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        gulp | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN mkdir /web-build \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && cd /web-build \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && curl -L "${URL}" | tar -xvz --strip-components=1 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /web-build | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY /web-vault/settings.Production.json /web-build/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN git config --global url."https://github.com/".insteadOf ssh://git@github.com/ \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && npm install \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && gulp dist:selfHosted \ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    && mv dist /web-vault | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					########################## BUILD IMAGE  ########################## | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# We need to use the Rust build image, because | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# we need the Rust compiler and Cargo tooling | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -53,7 +80,7 @@ EXPOSE 80 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Copies the files from the context (env file and web-vault) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# and the binary from the "build" stage to the current stage | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY .env . | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY web-vault ./web-vault | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=vault /web-vault ./web-vault | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=build app/target/release/bitwarden_rs . | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Configures the startup! | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -40,6 +40,8 @@ cargo build | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					``` | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## How to update the web-vault used | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					If you're using docker image, you can just update `VAULT_VERSION` variable in Dockerfile and rebuild the image. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					Install `node.js` and either `yarn` or `npm` (usually included with node) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					Clone the web-vault outside the project: | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					@ -0,0 +1,9 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    "appSettings": { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        "apiUri": "/api", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        "identityUri": "/identity", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        "iconsUri": "/icons", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        "stripeKey": "", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        "braintreeKey": "" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |