aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorMiroslav Prasil <[email protected]>2018-04-18 12:44:28 +0100
committerMiroslav Prasil <[email protected]>2018-04-18 12:55:06 +0100
commit818b5112678c15b764be1629d33bbc15aa0a3fcf (patch)
treec5ebe6efa682bf1467bb389825312623a8748282 /Dockerfile
parentb4a42054f952ca803fb411b1516960f64d2abf78 (diff)
downloadvaultwarden-818b5112678c15b764be1629d33bbc15aa0a3fcf.tar.gz
vaultwarden-818b5112678c15b764be1629d33bbc15aa0a3fcf.zip
Fetch Vault from upstream when building Docker image
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile29
1 files changed, 28 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index e4bd8ca6..758fd813 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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://[email protected]/ \
+ && 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!