Merge branch 'cicd'
Some checks failed
ci / docker (push) Has been cancelled

This commit is contained in:
Frank Villaro-Dixon 2024-10-13 01:24:02 +02:00
commit f781a392de
4 changed files with 37 additions and 9 deletions

View file

@ -0,0 +1,31 @@
name: ci
on:
push:
branches:
- "cicd"
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: forge.k3s.fr
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: forge.k3s.fr/elevation-api-eu/server:latest

View file

@ -5,7 +5,7 @@ FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
FROM chef AS builder
RUN apt update && apt install -y clang libgdal-dev
RUN apt install -y libclang-dev
COPY --from=planner /app/recipe.json recipe.json

View file

@ -37,7 +37,7 @@ impl DatasetRepository {
info!("Will open {full_filename} because not in cache!");
let ds = Dataset::open(full_filename.clone());
match ds {
Err(x) => {
Err(_) => {
error!("File not present");
return None;
}

View file

@ -10,7 +10,7 @@ use axum::{
use axum_macros::debug_handler;
use std::env;
use serde::ser::{SerializeSeq, Serializer};
use serde::ser::SerializeSeq;
use serde::{Deserialize, Deserializer, Serialize};
use serde_qs::axum::{QsQueryConfig, QsQueryRejection};
use tower_http::trace::TraceLayer;
@ -105,8 +105,8 @@ async fn main() {
.with_state(cache)
.layer(
TraceLayer::new_for_http()
.make_span_with(trace::DefaultMakeSpan::new().level(Level::DEBUG))
.on_response(trace::DefaultOnResponse::new().level(Level::DEBUG)),
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
)
.layer(Extension(QsQueryConfig::new(5, false).error_handler(
|err| {
@ -130,9 +130,6 @@ async fn get_elevation(
query_opts: Query<Opts>,
Path((lat, lon)): Path<(f64, f64)>,
) -> Response {
println!("lat: {}, lon: {}", lat, lon);
println!("query_opts: {:?}", query_opts);
let ele;
match dem::elevation_from_coordinates(&dsr, lat, lon).await {
Ok(x) => match x {
@ -147,7 +144,7 @@ async fn get_elevation(
#[derive(Serialize)]
struct Ele {
elevation: f64,
};
}
if query_opts.json {
let r = Ele { elevation: ele };