Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker-compose #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PROVER_ADDRESS="https://zkemail--email-auth-prover-v1-5-2-flask-app.modal.run"

DATABASE_URL="postgres://test@localhost/emailauth_test"
RELAYER_EMAIL_ADDR=
WEB_SERVER_ADDRESS="127.0.0.1:4500"
WEB_SERVER_ADDRESS=127.0.0.1:4500 # For docker-compose, use 0.0.0.0
EMAIL_TEMPLATES_PATH=./eml_templates
REGEX_JSON_DIR_PATH="./src/regex_json"

Expand All @@ -44,4 +44,6 @@ IC_REPLICA_URL="https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=fxmww-qiaaa-

CIRCUITS_DIR_PATH=../circuits

ERROR_EMAIL_ADDR="[email protected]"
ERROR_EMAIL_ADDR="[email protected]"

IC_PEM_CONTENT= # Set the base64-encoded content of ic.pem
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
members = ["packages/relayer"]
exclude = ["node_modules/*", "packages/relayer/src/abis"]
resolver = "2"

[profile.release]
lto = true
18 changes: 13 additions & 5 deletions Relayer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ FROM rust:latest AS builder
# Use bash as the shell
SHELL ["/bin/bash", "-c"]

# Install build-essential and other dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install NVM, Node.js, and Yarn
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
&& . $HOME/.nvm/nvm.sh \
Expand Down Expand Up @@ -45,9 +51,6 @@ RUN source $HOME/.nvm/nvm.sh && nvm use default && yarn && forge build
# Set the working directory for the Rust project and build it
WORKDIR /relayer/packages/relayer

# Copy the IC PEM file
COPY packages/relayer/.ic.pem /relayer/.ic.pem

# Build the Rust project with caching
RUN cargo build --release

Expand All @@ -57,14 +60,19 @@ FROM debian:bookworm-slim

# Install necessary runtime dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libssl-dev \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy the built binary from the builder stage
COPY --from=builder /relayer/target/release/relayer /usr/local/bin/relayer

# Copy the IC PEM file
COPY --from=builder /relayer/.ic.pem /relayer/.ic.pem
# Copy eml_templates directory from builder stage to root directory
COPY --from=builder /relayer/packages/relayer/eml_templates /eml_templates

# Copy regex_json directory from builder stage to root directory
COPY --from=builder /relayer/packages/relayer/src/regex_json /regex_json

# Expose the required port
EXPOSE 4500
Expand Down
3 changes: 2 additions & 1 deletion SMTP.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
WORKDIR /usr/src/relayer-smtp

# Clone the repository
RUN git clone https://github.com/zkemail/relayer-smtp.git .
RUN git clone https://github.com/zkfriendly/relayer-smtp.git .

# Build the application
RUN cargo build --release
Expand All @@ -24,6 +24,7 @@ FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy the built binary from the builder stage
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ version: '3.8'

services:
relayer-smtp:
build:
context: .
dockerfile: SMTP.Dockerfile
image: wshino/relayer-smtp:latest
container_name: relayer-smtp
ports:
- "3000:3000"
- "8080:8080"
env_file:
- .env
extra_hosts:
- "host.docker.internal:host-gateway"

relayer-imap:
build:
context: .
dockerfile: IMAP.Dockerfile
image: wshino/relayer-imap:latest
container_name: relayer-imap
ports:
- "3001:3001"
env_file:
- .env
extra_hosts:
- "host.docker.internal:host-gateway"

relayer:
build:
context: .
dockerfile: Relayer.Dockerfile
image: wshino/relayer:latest
container_name: relayer
ports:
- "4500:4500"
env_file:
- .env
- .env
entrypoint: >
/bin/sh -c "echo \"$IC_PEM_CONTENT\" | base64 -d > /.ic.pem && exec /usr/local/bin/relayer"
extra_hosts:
- "host.docker.internal:host-gateway"