Skip to content

Commit

Permalink
fix(deps): remove chrono (#29)
Browse files Browse the repository at this point in the history
* fix(deps): update rust crate chrono to 0.4.31

* fix(sec): removed chrono because of security advisor

Signed-off-by: Gabriel Melillo <gabriel@melillo.me>

* ci(deps): enable cache and fix dockerfile

* build(ci): install posix compliant tar

* build(ci): combine dependency install steps

* chore: update cargo deps from default branch

* ci: disable releases during maintenance tasks

---------

Signed-off-by: Gabriel Melillo <gabriel@melillo.me>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Melillo <gabriel@melillo.me>
Co-authored-by: Andrew Basson <andrew.basson@gmail.com>
  • Loading branch information
3 people authored Nov 5, 2023
1 parent 2d59d1b commit e47b3b0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/pull-requests-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ jobs:
image: nginx:latest
options: -v ${{ github.workspace }}/tests/resources/:/usr/share/nginx/html/ --name backend
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Restart nginx
uses: docker://docker
with:
args: docker restart backend
- uses: Swatinem/rust-cache@v1
- name: Install libvips
- name: Install build dependencies
run: apk add --update --no-cache
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/community
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main
curl
musl-dev=1.2.3-r5
vips-dev=8.13.3-r1
vips-heif=8.13.3-r1
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/community
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main
curl
musl-dev=1.2.3-r5
vips-dev=8.13.3-r1
vips-heif=8.13.3-r1
tar
- name: Check if nginx is available for files hosting
run: curl http://backend/exif --output /dev/null
- uses: Swatinem/rust-cache@v2
- name: Build Dali
run: RUSTFLAGS="-C target-feature=-crt-static $(pkg-config vips --libs)" cargo build
- name: Run Dali
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
publish_docker_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Adds execution permissions to the script which extracts the current version
run: chmod +x scripts/get-current-version.sh
- name: Build and Publish to GPR
run: make docker-publish
run: make docker-publish
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ prometheus = {version = "0.10.0", features = ["process", "nightly"] }
prometheus-static-metric = "0.5.1"
log = "0.4.20"
env_logger = "0.10.0"
chrono = "0.4.15"
serde = "1.0.190"
serde_derive = "1.0.190"
serde_json = "1.0.108"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /usr/src/dali
RUN apk add --update --no-cache \
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/community \
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main \
musl-dev=1.2.3-r4 \
musl-dev=1.2.3-r5 \
vips-dev=8.13.3-r1

COPY . .
Expand All @@ -23,4 +23,4 @@ RUN apk add --update --no-cache \

COPY --from=build /usr/src/dali/target/release/dali /usr/local/bin/dali

CMD ["dali"]
CMD ["dali"]
8 changes: 8 additions & 0 deletions src/commons/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ use log::*;
use serde_derive::*;
use std::fmt;


pub fn timestamp_millis() -> u128 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_millis()
}

#[derive(Debug, Deserialize, Clone)]
pub struct ProcessImageRequest {
pub image_address: String,
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use actix_http::KeepAlive;
use actix_service::Service;
use actix_web::{dev::Body, web, App, HttpRequest, HttpResponse, HttpServer};

use chrono::Utc;
use futures::future::join_all;
use image_processor::*;
use lazy_static::*;
Expand Down Expand Up @@ -202,7 +201,7 @@ async fn main() -> std::io::Result<()> {
writeln!(
f,
r#"{{"timestamp": {}, "level": "{}","target": "{}","message": {}}}"#,
Utc::now().timestamp_millis(),
commons::timestamp_millis(),
record.level(),
record.target(),
as_json,
Expand Down

0 comments on commit e47b3b0

Please sign in to comment.