Skip to content

Commit

Permalink
Add ADDITIONAL_SETUP_WORKER_CMD to Dockerfile
Browse files Browse the repository at this point in the history
This will allow users to do things like install custom packages
into the worker docker container.
  • Loading branch information
allada committed Sep 9, 2023
1 parent f645d69 commit 3c30387
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
13 changes: 11 additions & 2 deletions deployment-examples/docker-compose/Dockerfile
@@ -1,4 +1,4 @@
# Copyright 2022 The Turbo Cache Authors. All rights reserved.
# Copyright 2022-2023 The Turbo Cache Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,9 @@ ARG OPT_LEVEL=opt
ARG CC=clang
# Additional bazel flags.
ARG ADDITIONAL_BAZEL_FLAGS=
# Bash arguments my be passed in here to install any additional dependencies
# needed by the user. Useful if your worker needs specific dependencies installed.
ARG ADDITIONAL_SETUP_WORKER_CMD=


# Builder that contains the OS dependencies.
Expand All @@ -29,6 +32,7 @@ RUN apt update && apt-get -y install curl gnupg && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
git \
pkg-config \
libssl-dev \
Expand Down Expand Up @@ -115,7 +119,12 @@ COPY --from=builder-final /root/turbo-cache-bin /usr/local/bin/turbo-cache
# Install runtime packages.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
libssl-dev
libssl-dev ca-certificates

# Install any specific dependencies needed by the user.
ARG ADDITIONAL_SETUP_WORKER_CMD
RUN bash -c "${ADDITIONAL_SETUP_WORKER_CMD}"

RUN mkdir -p /root/.cache/turbo-cache
EXPOSE 50051/tcp 50052/tcp
CMD ["turbo-cache"]
17 changes: 13 additions & 4 deletions deployment-examples/docker-compose/docker-compose.yml
Expand Up @@ -12,47 +12,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version: '2.2'
version: '3.4'

services:
turbo_cache_local_cas:
image: allada/turbo-cache:latest
build:
context: ../..
dockerfile: ./deployment-examples/docker-compose/Dockerfile
network: host
volumes:
- ${TURBO_CACHE_DIR:-~/.cache/turbo-cache}:/root/.cache/turbo-cache
- type: bind
source: .
target: /root
environment:
RUST_LOG: ${RUST_LOG:-}
RUST_LOG: ${RUST_LOG:-warn}
ports: [ "50051:50051/tcp", "127.0.0.1:50061:50061" ]
command: |
turbo-cache /root/local-storage-cas.json
turbo_cache_scheduler:
image: allada/turbo-cache:latest
build:
context: ../..
dockerfile: ./deployment-examples/docker-compose/Dockerfile
network: host
volumes:
- type: bind
source: .
target: /root
environment:
RUST_LOG: ${RUST_LOG:-}
RUST_LOG: ${RUST_LOG:-warn}
CAS_ENDPOINT: turbo_cache_local_cas
ports: [ "50052:50052/tcp" ]
command: |
turbo-cache /root/scheduler.json
turbo_cache_executor:
image: allada/turbo-cache:latest
build:
context: ../..
dockerfile: ./deployment-examples/docker-compose/Dockerfile
network: host
volumes:
- ${TURBO_CACHE_DIR:-~/.cache/turbo-cache}:/root/.cache/turbo-cache
- type: bind
source: .
target: /root
environment:
RUST_LOG: ${RUST_LOG:-}
RUST_LOG: ${RUST_LOG:-warn}
CAS_ENDPOINT: turbo_cache_local_cas
SCHEDULER_ENDPOINT: turbo_cache_scheduler
command: |
Expand Down

0 comments on commit 3c30387

Please sign in to comment.