made changes to the dockerfile

This commit is contained in:
franklinblanco 2022-07-13 00:07:19 -04:00
parent a990f8d7cc
commit bb70a96858
4 changed files with 19 additions and 13 deletions

View File

@ -1,13 +1,11 @@
# 1. This tells docker to use the Rust official image
FROM rust:1.62
# 2. Copy the files in your machine to the Docker image
COPY ./ ./
WORKDIR /usr/src/user-svc
COPY . .
# Build your program for release
RUN cargo build --release
COPY ./target/release/user-svc-actix .
RUN rm -r `ls | grep -v "user-svc-actix"`
CMD ["user-svc-actix"]
# Run the binary
CMD ["./target/release/user-svc-actix"]

View File

@ -1,4 +1,4 @@
SELECT *
FROM user
WHERE user.email = ? AND
app = ?
user.app = ?

View File

@ -1,3 +1,3 @@
INSERT INTO user
(id, time_created, last_updated, email, app, name, password, salt) values
(id, time_created, last_updated, app, email, name, password, salt) values
(NULL, NOW(), NOW(), ?, ?, ?, ?, ?)

View File

@ -20,7 +20,15 @@ pub async fn start_database_connection(env_vars: &HashMap<String, String>) -> Re
None => panic!("DB_DATABASE_NAME env var not found")
};
let formatted_db_url = &format!("mysql://{db_user}:{db_pass}@{db_host}/{db_database_name}");
sqlx::MySqlConnection::connect(&formatted_db_url).await
let mut rs = sqlx::MySqlConnection::connect(&formatted_db_url).await;
for _i in 1..20 {
match &rs {
Ok(_conn) => {break;},
Err(_e) => {}
}
rs = sqlx::MySqlConnection::connect(&formatted_db_url).await;
}
rs
}
pub async fn run_all_migrations(conn: &mut MySqlConnection){
match sqlx::migrate!("./migrations").run(conn).await {