fix service
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 26m18s

This commit is contained in:
Nicholas Orlowsky 2025-09-14 13:49:34 -04:00
parent 3d1e213798
commit 534c36b0f7
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
2 changed files with 20 additions and 8 deletions

View file

@ -1,11 +1,11 @@
FROM rust:1.86.0 as build FROM rust:alpine as build
ENV PKG_CONFIG_ALLOW_CROSS=1 ENV PKG_CONFIG_ALLOW_CROSS=1
ENV SCCACHE_DIR=/build-cache ENV SCCACHE_DIR=/build-cache
ENV RUSTC_WRAPPER=sccache ENV RUSTC_WRAPPER=sccache
RUN apt update && apt install sccache RUN apk add pkgconfig openssl-dev libc-dev openssl-libs-static sccache
WORKDIR . WORKDIR .
COPY ./api ./api COPY ./api ./api
@ -16,8 +16,20 @@ COPY ./api/templates ./templates
RUN cd api && cargo build --release RUN cd api && cargo build --release
FROM alpine:latest
WORKDIR /app
RUN apk update \
&& apk add openssl ca-certificates
EXPOSE 8080
COPY --from=build /api/target/release/septastic_api /app/septastic_api
COPY api/assets /app/assets
COPY api/templates /app/templates
ENV RUST_LOG=info ENV RUST_LOG=info
ENV EXPOSE_PORT=8080 ENV EXPOSE_PORT=8080
EXPOSE 8080 RUN ls -lah
ENTRYPOINT ["/api/target/release/septastic_api"] RUN pwd
ENTRYPOINT ["./septastic_api"]

View file

@ -98,7 +98,7 @@ pub async fn get_schedule_by_route_id(
) -> ::anyhow::Result<Vec<Trip>> { ) -> ::anyhow::Result<Vec<Trip>> {
let schedule_day = chrono::Utc::now().with_timezone(&chrono_tz::America::New_York); let schedule_day = chrono::Utc::now().with_timezone(&chrono_tz::America::New_York);
let schedule_day_str = schedule_day.format("YYYYMMDD").to_string(); let schedule_day_str = schedule_day.format("%Y%m%d").to_string();
let rows = sqlx::query!( let rows = sqlx::query!(
r#"SELECT r#"SELECT
@ -125,8 +125,8 @@ pub async fn get_schedule_by_route_id(
AND AND
service_id IN (SELECT service_id FROM septa_schedule_days WHERE date = $2) service_id IN (SELECT service_id FROM septa_schedule_days WHERE date = $2)
;"#, ;"#,
id, id.clone(),
schedule_day_str schedule_day_str.clone()
) )
.fetch_all(&mut **transaction) .fetch_all(&mut **transaction)
.await?; .await?;
@ -228,7 +228,7 @@ pub async fn get_nta_by_stop_id(
let end_secs = local_end.signed_duration_since(local_midnight).num_seconds(); let end_secs = local_end.signed_duration_since(local_midnight).num_seconds();
let schedule_day = chrono::Utc::now().with_timezone(&chrono_tz::America::New_York); let schedule_day = chrono::Utc::now().with_timezone(&chrono_tz::America::New_York);
let schedule_day_str = schedule_day.format("YYYYMMDD").to_string(); let schedule_day_str = schedule_day.format("%Y%m%d").to_string();
let name_row = sqlx::query!("SELECT name FROM septa_stops WHERE id = $1", ids[0]).fetch_one(&mut **transaction).await?; let name_row = sqlx::query!("SELECT name FROM septa_stops WHERE id = $1", ids[0]).fetch_one(&mut **transaction).await?;