--- git/docker/amd64/sqlite/Dockerfile 2020-04-12 11:54:15.669082441 +0200 +++ Dockerfile 2020-04-12 13:30:04.212887482 +0200 @@ -36,9 +36,9 @@ 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 # Builds your dependencies and removes the # dummy project, except the target folder @@ -48,7 +48,7 @@ # 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 @@ -62,34 +62,25 @@ # because we already have a binary built FROM debian:buster-slim -ENV ROCKET_ENV "staging" -ENV ROCKET_PORT=80 -ENV ROCKET_WORKERS=10 - -# Install needed libraries -RUN apt-get update && apt-get install -y \ - --no-install-recommends \ - openssl \ - ca-certificates \ - curl \ - sqlite3 \ - && rm -rf /var/lib/apt/lists/* - -RUN mkdir /data -VOLUME /data -EXPOSE 80 -EXPOSE 3012 +# 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 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage -COPY Rocket.toml . -COPY --from=vault /web-vault ./web-vault -COPY --from=build app/target/release/bitwarden_rs . - -COPY docker/healthcheck.sh /healthcheck.sh - -HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] +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 +COPY --from=build app/target/release/bitwarden_rs /bitwarden_package/usr/local/bin -# Configures the startup! -WORKDIR / -CMD ["/bitwarden_rs"] +# Create the package +RUN dpkg-deb --build . bitwarden-rs.deb