From fc21919c2f66472e3b68dfe2649f3abc6b344335 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Fri, 13 Dec 2024 11:16:32 +0000 Subject: [PATCH] add support for docker image build on each new release --- .env.example | 1 + .github/workflows/release.yml | 0 Dockerfile | 16 +++++++++------- docker-compose.yaml | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.env.example b/.env.example index 39c6b994..dea150e0 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,4 @@ POSTGRES_PASSWORD= POSTGRES_PORT=5432 TRACE_LEVEL=info +ATOMA_PROXY_CONFIG_PATH=./config.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e69de29b diff --git a/Dockerfile b/Dockerfile index 16e19684..b7ea845a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,12 @@ # Builder stage -FROM rust:1.83-slim-bullseye as builder +FROM --platform=$BUILDPLATFORM rust:1.83-slim-bullseye AS builder +# Add platform-specific arguments +ARG TARGETPLATFORM +ARG BUILDPLATFORM +ARG TARGETARCH + +# Trace level argument ARG TRACE_LEVEL # Install build dependencies @@ -15,11 +21,11 @@ WORKDIR /usr/src/atoma-proxy COPY . . -# Build the application +# Compile RUN RUST_LOG=${TRACE_LEVEL} cargo build --release --bin atoma-proxy # Final stage -FROM debian:bullseye-slim +FROM --platform=$TARGETPLATFORM debian:bullseye-slim # Install runtime dependencies RUN apt-get update && apt-get install -y \ @@ -36,9 +42,6 @@ RUN mkdir -p /app/logs # Copy the built binary from builder stage COPY --from=builder /usr/src/atoma-proxy/target/release/atoma-proxy /usr/local/bin/atoma-proxy -# Copy configuration file -COPY config.toml ./config.toml - # Set executable permissions explicitly RUN chmod +x /usr/local/bin/atoma-proxy @@ -49,5 +52,4 @@ RUN chmod +x /usr/local/bin/entrypoint.sh # Copy host client.yaml and modify keystore path ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] -# Use full path in CMD CMD ["/usr/local/bin/atoma-proxy", "--config-path", "/app/config.toml"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 49a3d4bb..3e81041a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,13 +14,14 @@ services: - atoma-network atoma-proxy: + image: ghcr.io/atoma-network/atoma-proxy:latest build: context: . dockerfile: Dockerfile args: TRACE_LEVEL: ${TRACE_LEVEL:-info} volumes: - - ./config.toml:/app/config.toml + - ${CONFIG_PATH:-./config.toml}:/app/config.toml - ./logs:/app/logs - ${SUI_CONFIG_PATH:-~/.sui/sui_config}:/root/.sui/sui_config env_file: