Build from Dockerfile to improve caching
Some checks failed
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit

This should improve build times with changes that don't change the
dependencies in Cargo.toml.
This commit is contained in:
Cameron Cordes
2021-12-24 10:33:26 -05:00
parent 1e3f33c2d3
commit 6e39f8c58e
3 changed files with 8 additions and 4 deletions

4
Dockerfile.ci Normal file
View File

@@ -0,0 +1,4 @@
FROM rust:1.55
COPY Cargo.toml .
RUN cargo fetch
COPY src/ ./src/

6
Jenkinsfile vendored
View File

@@ -1,8 +1,8 @@
pipeline { pipeline {
agent { agent {
docker { dockerfile {
image 'rust:1.55' filename 'Dockerfile.ci'
args '-v "$PWD":/usr/src/image-api' args '-v "$PWD:/usr/src/image-api'
} }
} }

View File

@@ -36,7 +36,7 @@ pub async fn login(
if let Some(user) = user_dao.get_user(&creds.username, &creds.password) { if let Some(user) = user_dao.get_user(&creds.username, &creds.password) {
let claims = Claims { let claims = Claims {
sub: user.id.to_string(), sub: user.id.to_string(),
exp: (Utc::now() + Duration::days(5)).timestamp(), exp: (Utc::now() + Duration::minutes(1)).timestamp(),
}; };
let token = encode( let token = encode(
&Header::default(), &Header::default(),