Skip to content
Snippets Groups Projects
Commit 346c7630 authored by Miroslav Prasil's avatar Miroslav Prasil
Browse files

Initial implementation of musl build on top of Alpine

parent 1c57c9d8
No related branches found
No related tags found
No related merge requests found
......@@ -25,19 +25,11 @@ RUN npm run dist \
&& mv build /web-vault
########################## BUILD IMAGE ##########################
# We need to use the Rust build image, because
# we need the Rust compiler and Cargo tooling
FROM rust as build
# Using bundled SQLite, no need to install it
# RUN apt-get update && apt-get install -y\
# sqlite3\
# --no-install-recommends\
# && rm -rf /var/lib/apt/lists/*
# Musl build image for statically compiled binary
FROM clux/muslrust:nightly-2018-06-26 as build
# Creates a dummy project used to grab dependencies
RUN USER=root cargo new --bin app
WORKDIR /app
RUN USER=root cargo init --bin
# Copies over *only* your manifests and vendored dependencies
COPY ./Cargo.* ./
......@@ -61,17 +53,15 @@ RUN cargo build --release
######################## RUNTIME IMAGE ########################
# Create a new stage with a minimal image
# because we already have a binary built
FROM debian:stretch-slim
FROM alpine:3.8
ENV ROCKET_ENV "staging"
ENV ROCKET_WORKERS=10
# Install needed libraries
RUN apt-get update && apt-get install -y\
RUN apk add \
openssl\
ca-certificates\
--no-install-recommends\
&& rm -rf /var/lib/apt/lists/*
ca-certificates
RUN mkdir /data
VOLUME /data
......@@ -82,7 +72,7 @@ EXPOSE 80
COPY .env .
COPY Rocket.toml .
COPY --from=vault /web-vault ./web-vault
COPY --from=build app/target/release/bitwarden_rs .
COPY --from=build /volume/target/x86_64-unknown-linux-musl/release/bitwarden_rs .
# Configures the startup!
CMD ./bitwarden_rs
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment