-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include a docker-compose.yml template to run - payjoin-directory - redis - nginx - certbot in a valid configuration. Close #143
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Use the official Rust image as the builder | ||
FROM --platform=linux/amd64 rust:1.75-slim as builder | ||
|
||
WORKDIR /usr/src/payjoin-directory | ||
|
||
# Install cross-compilation dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
musl-tools \ | ||
musl-dev \ | ||
pkg-config \ | ||
gcc-multilib \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the linker | ||
ENV CC_x86_64_unknown_linux_musl=musl-gcc | ||
ENV AR_x86_64_unknown_linux_musl=ar | ||
|
||
# Add the x86_64-unknown-linux-musl target | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
|
||
# Copy the manifest and source code | ||
COPY payjoin-directory/Cargo.toml ./ | ||
COPY payjoin-directory/src/ ./src/ | ||
|
||
# Build the binary | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
# Create final minimal image | ||
FROM --platform=linux/amd64 alpine:latest | ||
|
||
# Copy the binary from builder | ||
COPY --from=builder /usr/src/payjoin-directory/target/x86_64-unknown-linux-musl/release/payjoin-directory ./ | ||
|
||
# Run the binary | ||
ENTRYPOINT ["./payjoin-directory"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
version: '3.8' | ||
|
||
services: | ||
nginx: | ||
image: nginx:latest | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- ./nginx/logs:/var/log/nginx | ||
- ./nginx/conf.d:/etc/nginx/conf.d | ||
- ./nginx/certs:/etc/ssl/certs | ||
- ./nginx/html:/var/www/html | ||
networks: | ||
- payjoin-network | ||
|
||
certbot: | ||
image: certbot/certbot | ||
volumes: | ||
- ./nginx/certs:/etc/letsencrypt | ||
- ./nginx/html:/var/www/html | ||
entrypoint: /bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot -w /var/www/html --deploy-hook "nginx -s reload"; sleep 12h & wait $${!}; done;' | ||
depends_on: | ||
- nginx | ||
networks: | ||
- payjoin-network | ||
|
||
payjoin-directory: | ||
image: dangould/payjoin-directory:0.0.1-rc0 | ||
environment: | ||
RUST_LOG: "trace" | ||
PJ_DB_HOST: "redis:6379" | ||
PJ_DIR_PORT: "8080" | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- redis | ||
networks: | ||
- payjoin-network | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- redis-data:/data | ||
networks: | ||
- payjoin-network | ||
|
||
networks: | ||
payjoin-network: | ||
driver: bridge | ||
|
||
volumes: | ||
redis-data: |