2020-11-10 11:08:37 +01:00
|
|
|
--- ./git/docker/arm32v7/Dockerfile 2020-10-31 15:04:00.786589801 +0100
|
|
|
|
+++ ./Dockerfile 2020-11-06 17:44:35.204501362 +0100
|
|
|
|
@@ -54,23 +54,23 @@
|
|
|
|
&& echo 'rustflags = ["-L/usr/lib/arm-linux-gnueabihf"]' >> ~/.cargo/config
|
|
|
|
|
|
|
|
ENV CARGO_HOME "/root/.cargo"
|
|
|
|
ENV USER "root"
|
2020-10-11 17:07:37 +02:00
|
|
|
|
|
|
|
# Creates a dummy project used to grab dependencies
|
|
|
|
RUN USER=root cargo new --bin /app
|
2019-03-27 10:19:46 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copies over *only* your manifests and build files
|
|
|
|
-COPY ./Cargo.* ./
|
|
|
|
-COPY ./rust-toolchain ./rust-toolchain
|
|
|
|
-COPY ./build.rs ./build.rs
|
|
|
|
+COPY git/Cargo.* ./
|
|
|
|
+COPY git/rust-toolchain ./rust-toolchain
|
|
|
|
+COPY git/build.rs ./build.rs
|
|
|
|
|
2020-11-10 11:08:37 +01:00
|
|
|
# NOTE: This should be the last apt-get/dpkg for this stage, since after this it will fail because of broken dependencies.
|
|
|
|
# For Diesel-RS migrations_macros to compile with MySQL/MariaDB we need to do some magic.
|
|
|
|
# We at least need libmariadb3:amd64 installed for the x86_64 version of libmariadb.so (client)
|
|
|
|
# We also need the libmariadb-dev-compat:amd64 but it can not be installed together with the :armhf version.
|
|
|
|
# What we can do is a force install, because nothing important is overlapping each other.
|
|
|
|
RUN apt-get install -y libmariadb3:amd64 && \
|
|
|
|
mkdir -pv /tmp/dpkg && \
|
|
|
|
cd /tmp/dpkg && \
|
|
|
|
apt-get download libmariadb-dev-compat:amd64 && \
|
|
|
|
@@ -90,64 +90,45 @@
|
|
|
|
RUN rustup target add armv7-unknown-linux-gnueabihf
|
2020-10-11 17:07:37 +02:00
|
|
|
|
2019-03-27 10:19:46 +01:00
|
|
|
# Builds your dependencies and removes the
|
|
|
|
# dummy project, except the target folder
|
2020-10-11 17:07:37 +02:00
|
|
|
# This folder contains the compiled dependencies
|
2020-11-10 11:08:37 +01:00
|
|
|
RUN cargo build --features ${DB} --release --target=armv7-unknown-linux-gnueabihf
|
2020-10-11 17:07:37 +02:00
|
|
|
RUN find . -not -path "./target*" -delete
|
2019-03-27 10:19:46 +01:00
|
|
|
|
|
|
|
# Copies the complete project
|
|
|
|
# To avoid copying unneeded files, use .dockerignore
|
|
|
|
-COPY . .
|
|
|
|
+COPY git .
|
|
|
|
|
|
|
|
# Make sure that we actually build the project
|
|
|
|
RUN touch src/main.rs
|
2020-10-11 17:07:37 +02:00
|
|
|
|
|
|
|
# Builds again, this time it'll just be
|
|
|
|
# your actual source files being built
|
2020-11-10 11:08:37 +01:00
|
|
|
RUN cargo build --features ${DB} --release --target=armv7-unknown-linux-gnueabihf
|
2020-10-11 17:07:37 +02:00
|
|
|
|
|
|
|
######################## RUNTIME IMAGE ########################
|
|
|
|
# Create a new stage with a minimal image
|
2019-03-27 10:19:46 +01:00
|
|
|
# because we already have a binary built
|
2020-11-10 11:08:37 +01:00
|
|
|
-FROM balenalib/armv7hf-debian:buster
|
|
|
|
+FROM debian:buster-slim
|
2019-03-27 10:19:46 +01:00
|
|
|
|
|
|
|
-ENV ROCKET_ENV "staging"
|
|
|
|
-ENV ROCKET_PORT=80
|
|
|
|
-ENV ROCKET_WORKERS=10
|
2019-12-02 08:19:14 +01:00
|
|
|
-
|
2020-11-10 11:08:37 +01:00
|
|
|
-RUN [ "cross-build-start" ]
|
|
|
|
-
|
|
|
|
-# Install needed libraries
|
|
|
|
-RUN apt-get update && apt-get install -y \
|
|
|
|
- --no-install-recommends \
|
|
|
|
- openssl \
|
|
|
|
- ca-certificates \
|
|
|
|
- curl \
|
|
|
|
- sqlite3 \
|
|
|
|
- libmariadb-dev-compat \
|
|
|
|
- libpq5 \
|
|
|
|
- && rm -rf /var/lib/apt/lists/*
|
|
|
|
-
|
2019-03-27 10:19:46 +01:00
|
|
|
-RUN mkdir /data
|
2020-11-10 11:08:37 +01:00
|
|
|
-
|
|
|
|
-RUN [ "cross-build-end" ]
|
|
|
|
-
|
2019-03-27 10:19:46 +01:00
|
|
|
-VOLUME /data
|
|
|
|
-EXPOSE 80
|
|
|
|
-EXPOSE 3012
|
2020-10-11 17:07:37 +02:00
|
|
|
-
|
|
|
|
-# Copies the files from the context (Rocket.toml file and web-vault)
|
|
|
|
-# and the binary from the "build" stage to the current stage
|
2019-03-27 10:19:46 +01:00
|
|
|
-COPY Rocket.toml .
|
|
|
|
-COPY --from=vault /web-vault ./web-vault
|
2020-11-10 11:08:37 +01:00
|
|
|
-COPY --from=build /app/target/armv7-unknown-linux-gnueabihf/release/bitwarden_rs .
|
2019-09-21 18:23:35 +02:00
|
|
|
-
|
2020-04-12 13:37:54 +02:00
|
|
|
-COPY docker/healthcheck.sh /healthcheck.sh
|
2020-07-22 18:39:16 +02:00
|
|
|
-COPY docker/start.sh /start.sh
|
2019-09-21 18:23:35 +02:00
|
|
|
-
|
2020-04-12 13:37:54 +02:00
|
|
|
-HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
|
2020-07-22 18:39:16 +02:00
|
|
|
-
|
|
|
|
-# Configures the startup!
|
|
|
|
-WORKDIR /
|
|
|
|
-CMD ["/start.sh"]
|
2020-10-11 17:07:37 +02:00
|
|
|
+# Create package directory
|
|
|
|
+RUN mkdir -p /bitwarden_package/DEBIAN
|
|
|
|
+RUN mkdir -p /bitwarden_package/usr/local/bin
|
|
|
|
+RUN mkdir -p /bitwarden_package/usr/lib/systemd/system
|
|
|
|
+RUN mkdir -p /bitwarden_package/etc/bitwarden_rs
|
|
|
|
+RUN mkdir -p /bitwarden_package/usr/share/bitwarden_rs
|
|
|
|
+
|
|
|
|
+WORKDIR /bitwarden_package
|
|
|
|
+
|
2019-03-27 10:19:46 +01:00
|
|
|
+COPY debian/control /bitwarden_package/DEBIAN/control
|
|
|
|
+COPY debian/postinst /bitwarden_package/DEBIAN/postinst
|
|
|
|
+COPY debian/conffiles /bitwarden_package/DEBIAN/conffiles
|
|
|
|
+COPY git/Rocket.toml /bitwarden_package/etc/bitwarden_rs
|
|
|
|
+COPY debian/config.env /bitwarden_package/etc/bitwarden_rs
|
|
|
|
+COPY debian/bitwarden_rs.service /bitwarden_package/usr/lib/systemd/system
|
|
|
|
+COPY --from=vault /web-vault /bitwarden_package/usr/share/bitwarden_rs/web-vault
|
2020-11-10 11:08:37 +01:00
|
|
|
+COPY --from=build app/target/armv7-unknown-linux-gnueabihf/release/bitwarden_rs /bitwarden_package/usr/local/bin
|
|
|
|
+
|
2019-03-27 10:19:46 +01:00
|
|
|
+# Create the package
|
|
|
|
+RUN dpkg-deb --build . bitwarden-rs.deb
|
2020-11-10 11:08:37 +01:00
|
|
|
|