diff --git a/Dockerfile b/Dockerfile index 75a8f13..0fa3310 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ ARG RUST_VERSION=1.82.0@sha256:33a0ea4769482be860174e1139c457bdcb2a236a988580a28c3a48824cbc17d6 FROM rust:$RUST_VERSION +WORKDIR /app # renovate: datasource=crate depName=diesel_cli versioning=semver ARG DIESEL_CLI_VERSION=2.2.4 @@ -11,9 +12,9 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && cargo install diesel_cli --version $DIESEL_CLI_VERSION --no-default-features --features postgres -WORKDIR /app -COPY . /app +COPY . . -RUN chmod +x /app/docker_entrypoint.sh +RUN cargo build --release \ + && chmod +x /app/docker_entrypoint.sh -ENTRYPOINT ["/app/docker_entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/app/docker_entrypoint.sh"] diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 632edba..55fef08 100644 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -8,15 +8,15 @@ echo "Waiting for PostgreSQL to be ready..." # Check for database readiness until diesel migration run --locked-schema; do - COUNTER=$((COUNTER + 1)) - if [ "$COUNTER" -ge "$RETRIES" ]; then - echo "Exceeded maximum retries, exiting." - exit 1 - fi + COUNTER=$((COUNTER + 1)) + if [ "$COUNTER" -ge "$RETRIES" ]; then + echo "Exceeded maximum retries, exiting." + exit 1 + fi - echo "Migrations failed, retrying in 5 seconds... (Attempt $COUNTER/$RETRIES)" - sleep 5 + echo "Migrations failed, retrying in 5 seconds... (Attempt $COUNTER/$RETRIES)" + sleep 5 done echo "Migrations ran successfully, starting the application..." -exec cargo run --release \ No newline at end of file +exec ./target/release/izumo