config server docker

This commit is contained in:
appflowy 2021-08-21 23:19:57 +08:00
parent 54342850b2
commit 952ac1cd3c
8 changed files with 43 additions and 15 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
.env
.dockerignore
doc/
scripts/
rust-lib/target/
backend/target/
app_flowy/

10
backend/.dockerignore Normal file
View File

@ -0,0 +1,10 @@
.env
.dockerignore
spec.yaml
target/
deploy/
tests/
Dockerfile
scripts/
migrations/
app_flowy/

View File

@ -42,7 +42,8 @@ features = [
"postgres",
"uuid",
"chrono",
"migrate"
"migrate",
"offline",
]

15
backend/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
# We use the latest Rust stable release as base image
FROM rust:1.53.0
# Let's switch our working directory to `app` (equivalent to `cd app`)
# The `app` folder will be created for us by Docker in case it does not
# exist already.
WORKDIR /app
# Copy all files from our working environment to our Docker image
COPY . .
# Let's build our binary!
# We'll use the release profile to make it faaaast
WORKDIR /app/backend
RUN cargo build --release
# When `docker run` is executed, launch the binary!
ENTRYPOINT ["./target/release/backend"]

View File

@ -2,6 +2,7 @@
### Docker
1. follow the [instructions](https://docs.docker.com/desktop/mac/install/) to install docker.
2. open terminal and run: `docker pull postgres`
@ -25,4 +26,6 @@ export DB_NAME=flowy
export DB_PORT=5433
```
![img_1.png](img_1.png)
![img_1.png](img_1.png)
[Docker command](https://docs.docker.com/engine/reference/commandline/builder_prune/)

View File

@ -7,11 +7,11 @@ edition = "2018"
[lib]
name = "dart_ffi"
# this value will change depending on the target os
# for iOS it would be `cdylib`
# for Macos it would be `cdylib`
# for iOS it would be `rlib`
# for Macos it would be `rlib`
# for android it would be `c-dylib`
# default cdylib
crate-type = ["cdylib"]
# default rlib
crate-type = ["rlib"]
[dependencies]

View File

@ -7,7 +7,7 @@ use bytes::Bytes;
use dyn_clone::DynClone;
use protobuf::ProtobufError;
use serde::{Serialize, Serializer};
use std::{fmt, option::NoneError};
use std::fmt;
use tokio::{sync::mpsc::error::SendError, task::JoinError};
pub trait Error: fmt::Debug + DynClone + Send + Sync {
@ -53,12 +53,6 @@ impl From<SendError<EventRequest>> for DispatchError {
}
}
impl From<NoneError> for DispatchError {
fn from(s: NoneError) -> Self {
InternalError::UnexpectedNone(format!("Unexpected none: {:?}", s)).into()
}
}
impl From<String> for DispatchError {
fn from(s: String) -> Self { InternalError::Other(s).into() }
}

View File

@ -1,5 +1,3 @@
#![feature(try_trait)]
mod errors;
mod module;
mod request;