Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3341470
D9063.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9063.diff
View Options
diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile
--- a/services/backup/Dockerfile
+++ b/services/backup/Dockerfile
@@ -1,51 +1,39 @@
-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/backup
-RUN mkdir -p /home/comm/app/backup
-WORKDIR /home/comm/app/backup
-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
-# Cache build dependencies in a new layer
-COPY services/backup/Cargo.toml services/backup/Cargo.lock ./
-COPY services/comm-services-lib ../comm-services-lib
-RUN cargo build --release && rm src/*.rs
+ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# Copy actual application sources
-COPY services/backup .
+COPY services/comm-services-lib ../comm-services-lib
+COPY services/backup ./
-# Remove the previously-built binary so that only the application itself is
-# rebuilt
-RUN rm ./target/release/deps/backup*
-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/backup /usr/local/bin/backup
+WORKDIR /home/comm/app/backup
# 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/backup
-COPY --from=builder /home/comm/app/backup/target/release/backup .
-
-ARG COMM_SERVICES_SANDBOX
-ENV COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX}
-ARG LOCALSTACK_URL
-ENV LOCALSTACK_URL=${LOCALSTACK_URL}
-ARG BLOB_SERVICE_URL
-ENV BLOB_SERVICE_URL=${BLOB_SERVICE_URL}
-
-CMD ./backup \
- --localstack-url ${LOCALSTACK_URL} \
- --blob-service-url ${BLOB_SERVICE_URL}
- # The COMM_SERVICES_SANDBOX is processed by the executable
+ENV RUST_LOG=info
+
+CMD ["backup"]
diff --git a/services/docker-compose.yml b/services/docker-compose.yml
--- a/services/docker-compose.yml
+++ b/services/docker-compose.yml
@@ -18,20 +18,18 @@
- $HOME/.aws/credentials:/home/comm/.aws/credentials:ro
# backup
backup-server:
+ platform: linux/amd64
depends_on:
- localstack
- blob-server
build:
dockerfile: services/backup/Dockerfile
context: ../
- args:
- - COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX}
- - LOCALSTACK_URL=http://localstack:4566
- - BLOB_SERVICE_URL=http://blob-server:50051
- image: commapp/backup-server:0.1
+ image: commapp/backup-server:0.2
ports:
- - '${COMM_SERVICES_PORT_BACKUP}:50051'
+ - '${COMM_SERVICES_PORT_BACKUP}:50052'
volumes:
+ - $HOME/.aws/config:/home/comm/.aws/config:ro
- $HOME/.aws/credentials:/home/comm/.aws/credentials:ro
# blob
blob-server:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 10:59 PM (18 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2566337
Default Alt Text
D9063.diff (3 KB)
Attached To
Mode
D9063: [backup] Update backup dockerfile
Attached
Detach File
Event Timeline
Log In to Comment