Dockerize services

Signed-off-by: Adam Szkoda <adaszko@gmail.com>
This commit is contained in:
Adam Szkoda 2022-12-08 14:54:51 +01:00 committed by Alexis Sellier
parent aa02c52a2f
commit 4abb24feca
No known key found for this signature in database
4 changed files with 104 additions and 0 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
target

59
docker-compose.yml Normal file
View File

@ -0,0 +1,59 @@
version: "3.7"
services:
radicle-node:
image: gcr.io/radicle-services/radicle-node:${RADICLE_IMAGE_TAG:-latest}
build:
dockerfile: ./radicle-node/Dockerfile
context: .
environment:
RUST_LOG: debug
init: true
container_name: radicle-node
restart: unless-stopped
networks:
- radicle-services
deploy:
resources:
limits:
memory: 6gb
radicle-httpd:
image: gcr.io/radicle-services/radicle-httpd:${RADICLE_IMAGE_TAG:-latest}
build:
dockerfile: ./radicle-httpd/Dockerfile
context: .
environment:
RUST_LOG: debug
init: true
container_name: radicle-httpd
restart: unless-stopped
networks:
- radicle-services
deploy:
resources:
limits:
memory: 6gb
caddy:
image: caddy:2.4.5
entrypoint:
- sh
- -euc
- |
cat <<EOF >/etc/caddy/Caddyfile
{$RADICLE_DOMAIN} {
reverse_proxy radicle-httpd:8778
}
EOF
caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
ports:
- 80:80
- 443:443
environment:
RADICLE_DOMAIN: $RADICLE_DOMAIN
container_name: caddy
restart: unless-stopped
networks:
- radicle-services
networks:
radicle-services:
name: radicle-services

22
radicle-httpd/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# Build
FROM rust:1.65.0-slim@sha256:27349440d16ac15f52e8cae6181999a1b2fc05272d612a358d0e53078fcef88e as build
RUN apt-get update && apt-get install -y pkg-config libssl-dev git cmake
COPY . /app
WORKDIR /app/radicle-httpd
RUN set -eux; \
cargo install --locked --path .; \
objcopy --compress-debug-sections /usr/local/cargo/bin/radicle-httpd /usr/local/cargo/bin/radicle-httpd.compressed
# Run
FROM debian:bullseye-slim@sha256:25f10b4f1ded5341a3ca0a30290ff3cd5639415f0c5a2222d5e7d5dd72952aa1
RUN echo deb http://deb.debian.org/debian bullseye-backports main contrib non-free >/etc/apt/sources.list.d/backports.list
RUN apt-get update && apt-get install -y libssl1.1 && apt -t bullseye-backports install --yes git && rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/local/cargo/bin/radicle-httpd.compressed /usr/local/bin/radicle-httpd
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/radicle-httpd"]

22
radicle-node/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# Build
FROM rust:1.65.0-slim@sha256:27349440d16ac15f52e8cae6181999a1b2fc05272d612a358d0e53078fcef88e as build
RUN apt-get update && apt-get install -y pkg-config libssl-dev git cmake
COPY . /app
WORKDIR /app/radicle-node
RUN set -eux; \
cargo install --locked --path .; \
objcopy --compress-debug-sections /usr/local/cargo/bin/radicle-node /usr/local/cargo/bin/radicle-node.compressed
# Run
FROM debian:bullseye-slim@sha256:25f10b4f1ded5341a3ca0a30290ff3cd5639415f0c5a2222d5e7d5dd72952aa1
RUN echo deb http://deb.debian.org/debian bullseye-backports main contrib non-free >/etc/apt/sources.list.d/backports.list
RUN apt-get update && apt-get install -y libssl1.1 && apt -t bullseye-backports install --yes git && rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/local/cargo/bin/radicle-node.compressed /usr/local/bin/radicle-node
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/radicle-node"]