diff --git a/Dockerfile b/Dockerfile index 996a3a1..8115b54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,8 @@ RUN cargo build --release # Run stage FROM debian:bookworm-slim RUN apt-get update && apt-get install -y libssl3 ca-certificates libsqlite3-0 && apt-get clean -COPY --from=builder /usr/src/app/Neighborhood_Map_Atlas_Neighborhoods.geojson / +COPY --from=builder /usr/src/app/storage/Neighborhood_Map_Atlas_Neighborhoods.geojson /storage/ COPY --from=builder /usr/src/app/target/release/mapbattle /usr/local/bin/mapbattle -COPY --from=builder /usr/src/app/mapbattle.db / +COPY --from=builder /usr/src/app/storage/mapbattle.db /storage/ EXPOSE 8080 CMD ["mapbattle"] \ No newline at end of file diff --git a/db/setup_db.sh b/db/setup_db.sh index e27b4cf..2806ba1 100755 --- a/db/setup_db.sh +++ b/db/setup_db.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash cd $(dirname "$0") -sqlite3 ../mapbattle.db < db.sql -sqlite3 -csv ../mapbattle.db ".import init_games.csv games" -sqlite3 -csv ../mapbattle.db ".import init_teams.csv teams" \ No newline at end of file +db_file='../storage/mapbattle.db' +sqlite3 "$dbfile" < db.sql +sqlite3 -csv "$dbfile" ".import init_games.csv games" +sqlite3 -csv "$dbfile" ".import init_teams.csv teams" diff --git a/src/geo_utils.rs b/src/geo_utils.rs index 35685cc..8668831 100644 --- a/src/geo_utils.rs +++ b/src/geo_utils.rs @@ -21,8 +21,9 @@ impl GeoUtils { } fn load_feature_collection() -> FeatureCollection { - let txt: String = fs::read_to_string("Neighborhood_Map_Atlas_Neighborhoods.geojson") - .expect("file should be present"); + let txt: String = + fs::read_to_string("./storage/Neighborhood_Map_Atlas_Neighborhoods.geojson") + .expect("file should be present"); let geojson_str = txt; let geojson: GeoJson = geojson_str.parse::().unwrap(); FeatureCollection::try_from(geojson).unwrap() diff --git a/src/main.rs b/src/main.rs index 7616931..ad3e1cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -209,7 +209,7 @@ async fn main() -> std::io::Result<()> { } env_logger::init(); - let manager = SqliteConnectionManager::file("mapbattle.db"); + let manager = SqliteConnectionManager::file("./storage/mapbattle.db"); let pool = Pool::new(manager).unwrap(); let games = db::games(&pool) .await diff --git a/Neighborhood_Map_Atlas_Neighborhoods.geojson b/storage/Neighborhood_Map_Atlas_Neighborhoods.geojson similarity index 100% rename from Neighborhood_Map_Atlas_Neighborhoods.geojson rename to storage/Neighborhood_Map_Atlas_Neighborhoods.geojson