| 
						
						
						
					 | 
					@ -1,16 +1,10 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					{{ "# This file was generated using a Jinja2 template." }} | 
					 | 
					 | 
					# This file was generated using a Jinja2 template. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					{{ "# Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfile's." }} | 
					 | 
					 | 
					# Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfile's. | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					# Using multistage build: | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					# 	https://docs.docker.com/develop/develop-images/multistage-build/ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					# 	https://whitfin.io/speeding-up-rust-docker-builds/ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					####################### VAULT BUILD IMAGE  ####################### | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% set build_stage_base_image = "rust:1.40" %} | 
					 | 
					 | 
					{% set build_stage_base_image = "rust:1.40" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% set vault_stage_base_image = build_stage_base_image %} | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% if "alpine" in target_file %} | 
					 | 
					 | 
					{% if "alpine" in target_file %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set build_stage_base_image = "clux/muslrust:nightly-2019-12-19" %} | 
					 | 
					 | 
					{%   set build_stage_base_image = "clux/muslrust:nightly-2019-12-19" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set runtime_stage_base_image = "alpine:3.11" %} | 
					 | 
					 | 
					{%   set runtime_stage_base_image = "alpine:3.11" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set vault_stage_base_image = runtime_stage_base_image %} | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set package_arch_name = "" %} | 
					 | 
					 | 
					{%   set package_arch_name = "" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% elif "amd64" in target_file %} | 
					 | 
					 | 
					{% elif "amd64" in target_file %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set runtime_stage_base_image = "debian:buster-slim" %} | 
					 | 
					 | 
					{%   set runtime_stage_base_image = "debian:buster-slim" %} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -29,29 +23,23 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% if package_arch_name == "" %} | 
					 | 
					 | 
					{% if package_arch_name == "" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{%   set package_arch_prefix = "" %} | 
					 | 
					 | 
					{%   set package_arch_prefix = "" %} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% endif %} | 
					 | 
					 | 
					{% endif %} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					FROM {{ vault_stage_base_image }} as vault | 
					 | 
					 | 
					# Using multistage build: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					# 	https://docs.docker.com/develop/develop-images/multistage-build/ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					ENV VAULT_VERSION "v2.12.0d" | 
					 | 
					 | 
					# 	https://whitfin.io/speeding-up-rust-docker-builds/ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					####################### VAULT BUILD IMAGE  ####################### | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					ENV URL "https://github.com/dani-garcia/bw_web_builds/releases/download/$VAULT_VERSION/bw_web_$VAULT_VERSION.tar.gz" | 
					 | 
					 | 
					{% set vault_image_hash = "sha256:ce56b3f5e538351411785ac45e9b4b913259c3508b1323d62e8fa0f30717dd1c" %} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					{% raw %} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					{% if "alpine" in vault_stage_base_image %} | 
					 | 
					 | 
					#  This hash is extracted from the docker web-vault builds and it's prefered over a simple tag because it's immutable. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					RUN apk add --no-cache --upgrade curl tar | 
					 | 
					 | 
					#  It can be viewed in multiple ways: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					{% else %} | 
					 | 
					 | 
					#  - From the https://hub.docker.com/repository/docker/bitwardenrs/web-vault/tags page, click the tag name and the digest should be there. | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					# Build time options to avoid dpkg warnings and help with reproducible builds. | 
					 | 
					 | 
					#  - From the console, with the following commands: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 TZ=UTC TERM=xterm-256color | 
					 | 
					 | 
					#      docker pull bitwardenrs/web-vault:v2.12.0e | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					{% endif %} | 
					 | 
					 | 
					#      docker image inspect --format "{{.RepoDigests}}" bitwardenrs/web-vault:v2.12.0e | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					#       | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					WORKDIR / | 
					 | 
					 | 
					#  - To do the opposite, and get the tag from the hash, you can do: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					#      docker image inspect --format "{{.RepoTags}}" bitwardenrs/web-vault@sha256:ce56b3f5e538351411785ac45e9b4b913259c3508b1323d62e8fa0f30717dd1c | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					{% if "alpine" in vault_stage_base_image %} | 
					 | 
					 | 
					{% endraw %} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					SHELL ["/bin/ash", "-o", "nounset", "-o", "pipefail", "-o", "errexit", "-c"] | 
					 | 
					 | 
					FROM bitwardenrs/web-vault@{{ vault_image_hash }} as vault | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					{% else %} | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					SHELL ["/bin/bash", "-o", "nounset", "-o", "pipefail", "-o", "errexit", "-c"] | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% endif %} | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					RUN curl -L $URL | tar xz | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					RUN ls | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					########################## BUILD IMAGE  ########################## | 
					 | 
					 | 
					########################## BUILD IMAGE  ########################## | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{% if "musl" in build_stage_base_image %} | 
					 | 
					 | 
					{% if "musl" in build_stage_base_image %} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |