Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Bragi switch to alpine #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,343 changes: 727 additions & 616 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 6 additions & 15 deletions docker/bragi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# Builder image
# =============

FROM rust:1.60-buster as builder
FROM rust:1.60-alpine3.15 as builder

WORKDIR /home

ENV DEBIAN_FRONTEND noninteractive
RUN apk --update --no-cache add pkgconfig make sqlite-dev libressl-dev git musl-dev

RUN apt-get update
RUN apt-get install -y pkg-config make libsqlite3-dev libssl-dev git
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*;

RUN USER=root cargo new mimirsbrunn
RUN cargo new mimirsbrunn

WORKDIR /home/mimirsbrunn

Expand All @@ -26,6 +21,7 @@ COPY ./build.rs ./build.rs
COPY ./tests ./tests
COPY ./benches ./benches

ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/home/mimirsbrunn/target \
cargo build --profile production --bin bragi --locked --features db-storage
Expand All @@ -39,17 +35,12 @@ RUN --mount=type=cache,target=/home/mimirsbrunn/target \
# Target image
# ============

FROM debian:buster-slim
FROM alpine:3.15

WORKDIR /srv

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
# curl required for healthchecks
RUN apt-get install -y curl libcurl4 sqlite3
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apk --update --no-cache add curl sqlite libressl libgcc

COPY config /etc/bragi
COPY docker/run_with_default_config.sh .
Expand Down
2 changes: 1 addition & 1 deletion docker/run_with_default_config.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
sinaure marked this conversation as resolved.
Show resolved Hide resolved

# Call the given command with extra defaults `--run-mode` `--config-dir`
# parameter values.
Expand Down
4 changes: 2 additions & 2 deletions libs/mimir/src/adapters/secondary/elasticsearch/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl ElasticsearchStorage {
) -> Result<InsertStats, Error>
where
D: Document + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync,
S: Stream<Item = D> + Send,
{
let stats = self
.bulk(
Expand Down Expand Up @@ -578,7 +578,7 @@ impl ElasticsearchStorage {
async fn bulk<D, S>(&self, index: String, documents: S) -> Result<InsertStats, Error>
where
D: Serialize + Send + Sync + 'static,
S: Stream<Item = BulkOperation<D>> + Send + Sync,
S: Stream<Item = BulkOperation<D>> + Send,
{
let stats = documents
.chunks(self.config.insertion_chunk_size)
Expand Down
2 changes: 1 addition & 1 deletion libs/mimir/src/adapters/secondary/elasticsearch/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<'s> Storage<'s> for ElasticsearchStorage {
) -> Result<InsertStats, StorageError>
where
D: Document + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync + 's,
S: Stream<Item = D> + Send + 's,
{
self.add_pipeline(
include_str!(concat!(
Expand Down
6 changes: 3 additions & 3 deletions libs/mimir/src/domain/ports/primary/generate_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
) -> Result<Index, ModelError>
where
D: ContainerDocument + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync + 's;
S: Stream<Item = D> + Send + 's;
}

#[async_trait(?Send)]
Expand Down Expand Up @@ -73,7 +73,7 @@ where
) -> Result<Index, ModelError>
where
D: ContainerDocument + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync + 's,
S: Stream<Item = D> + Send + 's,
{
self.init_container(config)
.await?
Expand Down Expand Up @@ -107,7 +107,7 @@ where
#[tracing::instrument(skip(self, documents))]
pub async fn insert_documents(
self,
documents: impl Stream<Item = D> + Send + Sync + 's,
documents: impl Stream<Item = D> + Send + 's,
) -> Result<ContainerGenerator<'a, D, T>, ModelError> {
let stats = self
.storage
Expand Down
4 changes: 2 additions & 2 deletions libs/mimir/src/domain/ports/secondary/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait Storage<'s> {
) -> Result<InsertStats, Error>
where
D: Document + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync + 's;
S: Stream<Item = D> + Send + 's;

async fn update_documents<S>(&self, index: String, operations: S) -> Result<InsertStats, Error>
where
Expand Down Expand Up @@ -98,7 +98,7 @@ where
) -> Result<InsertStats, Error>
where
D: Document + Send + Sync + 'static,
S: Stream<Item = D> + Send + Sync + 's,
S: Stream<Item = D> + Send + 's,
{
(**self).insert_documents(index, documents).await
}
Expand Down
4 changes: 2 additions & 2 deletions src/addr_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ where
fn records_from_path<T>(
path: &Path,
has_headers: bool,
) -> impl Stream<Item = Result<T, Error>> + Send + Sync + 'static
) -> impl Stream<Item = Result<T, Error>> + Send + 'static
where
T: DeserializeOwned + Send + Sync + 'static,
{
Expand All @@ -128,7 +128,7 @@ where
async fn records_from_file<T>(
file: &Path,
has_headers: bool,
) -> Result<impl Stream<Item = Result<T, Error>> + Send + Sync + 'static, Error>
) -> Result<impl Stream<Item = Result<T, Error>> + Send + 'static, Error>
where
T: DeserializeOwned + Send + Sync + 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl IntoAdmin for Zone {
let label = self.label;
let weight = get_weight(&self.tags, &self.center_tags);
let center = self.center.map_or(places::coord::Coord::default(), |c| {
places::coord::Coord::new(c.lng(), c.lat())
places::coord::Coord::new(c.x(), c.y())
});
let format_id = |id, insee| {
// for retrocompatibity reasons, Navitia needs the
Expand Down