v0.13-dockerP1

This commit is contained in:
2022-11-28 00:08:14 +05:30
parent 131ab0cf9e
commit 9d3c1fc295
6 changed files with 47 additions and 4 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
*/target*
data

6
.env
View File

@@ -1,6 +1,6 @@
DATABASE_URL="sqlite:./sqlite.db?mode=rwc"
IMAGES_DIR="../images"
CORS_URL="http://localhost:8080"
DATABASE_URL="sqlite:/data/db/sqlite.db?mode=rwc"
IMAGES_DIR="/data/images"
CORS_URL="*"
MEILI_URL="http://meili:7700"
MEILI_KEY="asdasdasd"
BACKEND_URL="http://localhost:8081"

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ backend/target/
backend/sqlite.db
dist/
images/*
data/*
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM rust:alpine as builder
RUN apk update
RUN apk add --no-cache openssl-dev musl-dev
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN rustup target add wasm32-unknown-unknown
RUN cd frontend && cargo install trunk && trunk build --release
RUN cd backend && cargo build --release
#FROM alpine:latest
#WORKDIR /usr/src/app
#COPY --from=builder /usr/src/app/backend/target/x86_64-unknown-linux-musl/release/booksman /usr/src/app/booksman
#COPY --from=builder /usr/src/app/dist /usr/src/dist

View File

@@ -300,7 +300,7 @@ async fn create_by_isbn(
}
let mut goodread_id = "".to_string();
if !bookfound.unwrap().identifiers.is_none() {
let goodread_identifier = bookfound.clone().unwrap().identifiers.clone().unwrap().goodreads
let goodread_identifier = bookfound.clone().unwrap().identifiers.clone().unwrap().goodreads;
if !goodread_identifier.is_none() {
goodread_id = goodread_identifier.unwrap().get(0).unwrap().to_string()
}

23
docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: '3'
services:
booksman:
container_name: booksman
build: .
volumes:
- ./data/db:/data/db
- ./data/images:/data/images
expose:
- "8081"
depends_on:
- meilisearch
meilisearch:
container_name: meilisearch
image: getmeili/meilisearch:v0.29
volumes:
- ./data/meilisearch:/data.ms
expose:
- "7700"
environment:
- MEILI_MASTER_KEY=${MEILI_KEY}