Page MenuHomePhabricator

D9116.id30906.diff
No OneTemporary

D9116.id30906.diff

diff --git a/services/blob/Dockerfile b/services/blob/Dockerfile
--- a/services/blob/Dockerfile
+++ b/services/blob/Dockerfile
@@ -1,44 +1,41 @@
-FROM commapp/services-base:1.3.2 as builder
+FROM rust:1.70-bullseye as builder
-ENV PATH=/root/.cargo/bin:$PATH
-
-# Install Curl
-RUN apt-get update \
- && DEBIAN_FRONTEND=noninteractive apt-get install -y curl \
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ build-essential cmake git libgtest-dev libssl-dev zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
-# Install Rust
-RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
+WORKDIR /home/root/app/blob
-RUN mkdir -p /home/comm/app/blob
-WORKDIR /home/comm/app/blob
-RUN cargo init --bin
+# Install more recent version of protobuf, must be ran as root
+COPY scripts/install_protobuf.sh ../../scripts/install_protobuf.sh
+RUN ../../scripts/install_protobuf.sh
+
+ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
-# Cache build dependencies in a new layer
-COPY services/blob/Cargo.toml services/blob/Cargo.lock ./
-COPY services/comm-services-lib ../comm-services-lib
-RUN cargo build --release && rm src/*.rs
# Copy actual application sources
-COPY services/blob .
+COPY services/comm-services-lib ../comm-services-lib
+COPY services/blob ./
-# Remove the previously-built binary so that only the application itself is
-# rebuilt
-RUN rm ./target/release/deps/blob*
-RUN cargo build --release
+RUN cargo install --locked --path .
# Runner stage
-FROM commapp/services-base:1.3.2 as runner
+FROM debian:bullseye-slim as runner
+
+# Update dependencies, install ca-certificates which are required for TLS
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ ca-certificates \
+ && rm -rf /var/lib/apt/lists/*
+
+# Only copy built binary from builder stage
+COPY --from=builder /usr/local/cargo/bin/blob /usr/local/bin/blob
+WORKDIR /home/comm/app/blob
# Create a new user comm and use it to run subsequent commands
RUN useradd -m comm
USER comm
-# Only copy built binary from builder stage
-WORKDIR /home/comm/app/blob
-COPY --from=builder /home/comm/app/blob/target/release/blob .
+ENV RUST_LOG=info
-ARG COMM_SERVICES_SANDBOX
-ENV COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX}
+CMD ["blob"]
-CMD ["./blob"]
diff --git a/services/docker-compose.yml b/services/docker-compose.yml
--- a/services/docker-compose.yml
+++ b/services/docker-compose.yml
@@ -39,8 +39,6 @@
build:
dockerfile: services/blob/Dockerfile
context: ../
- args:
- - COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX}
image: commapp/blob-server:0.1
ports:
- '${COMM_SERVICES_PORT_BLOB}:50053'

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 6:19 AM (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610558
Default Alt Text
D9116.id30906.diff (2 KB)

Event Timeline