diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 3494310..42309e3 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -39,8 +39,8 @@ jobs: context: ./web-app push: true tags: ghcr.io/${{ steps.repo_name.outputs.name }}/web-app:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=web-app + cache-to: type=gha,mode=max,scope=web-app - name: Build and push Rust engine image ⚙️ uses: docker/build-push-action@v6 @@ -48,8 +48,8 @@ jobs: context: ./rust-engine push: true tags: ghcr.io/${{ steps.repo_name.outputs.name }}/rust-engine:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=rust-engine + cache-to: type=gha,mode=max,scope=rust-engine - name: Ensure remote deploy directory exists uses: appleboy/ssh-action@v1.0.3 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 5e6ed85..f04e0b7 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,6 +19,8 @@ services: - DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE} depends_on: - mysql + volumes: + - ~/astra-errors.log:/var/log/astra-errors.log mysql: image: mysql:8.0 diff --git a/rust-engine/Dockerfile b/rust-engine/Dockerfile index 813bd81..c8cfd04 100644 --- a/rust-engine/Dockerfile +++ b/rust-engine/Dockerfile @@ -69,10 +69,13 @@ RUN useradd --system --uid 10001 --no-create-home --shell /usr/sbin/nologin appu # Copy the compiled binary from the builder stage -# Copy the compiled binary and set ownership COPY --from=builder /usr/src/app/target/release/rust-engine /usr/local/bin/rust-engine -RUN chown appuser:appuser /usr/local/bin/rust-engine +RUN chown appuser:appuser /usr/local/bin/rust-engine \ + && mkdir -p /var/log \ + && touch /var/log/astra-errors.log \ + && chown appuser:appuser /var/log/astra-errors.log EXPOSE 8000 USER appuser -CMD ["rust-engine"] \ No newline at end of file +# Redirect all output to /var/log/astra-errors.log for easy monitoring +ENTRYPOINT ["/bin/sh", "-c", "/usr/local/bin/rust-engine >> /var/log/astra-errors.log 2>&1"] \ No newline at end of file