Merge branch 'develop' into ivago-calendar

master
Jef Roosens 2021-03-23 10:58:41 +01:00
commit 2519f8b86d
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
5 changed files with 180 additions and 118 deletions

193
Cargo.lock generated
View File

@ -124,9 +124,9 @@ checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
[[package]]
name = "byteorder"
version = "1.4.2"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
@ -161,7 +161,7 @@ dependencies = [
"libc",
"num-integer",
"num-traits",
"time 0.1.43",
"time 0.1.44",
"winapi 0.3.9",
]
@ -193,7 +193,7 @@ dependencies = [
"percent-encoding 2.1.0",
"rand",
"sha2",
"time 0.1.43",
"time 0.1.44",
]
[[package]]
@ -203,8 +203,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951"
dependencies = [
"percent-encoding 2.1.0",
"time 0.2.25",
"version_check 0.9.2",
"time 0.2.26",
"version_check 0.9.3",
]
[[package]]
@ -219,7 +219,7 @@ dependencies = [
"publicsuffix",
"serde",
"serde_json",
"time 0.2.25",
"time 0.2.26",
"url 2.2.1",
]
@ -326,6 +326,17 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "fej"
version = "0.0.1"
dependencies = [
"chrono",
"reqwest",
"rocket",
"rocket_contrib",
"serde",
]
[[package]]
name = "filetime"
version = "0.2.14"
@ -459,7 +470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@ -556,12 +567,13 @@ dependencies = [
[[package]]
name = "http-body"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737"
dependencies = [
"bytes",
"http",
"pin-project-lite",
]
[[package]]
@ -588,7 +600,7 @@ dependencies = [
"log 0.3.9",
"mime 0.2.6",
"num_cpus",
"time 0.1.43",
"time 0.1.44",
"traitobject",
"typeable",
"unicase",
@ -656,9 +668,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.6.1"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
dependencies = [
"autocfg",
"hashbrown",
@ -707,9 +719,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "js-sys"
version = "0.3.48"
version = "0.3.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
dependencies = [
"wasm-bindgen",
]
@ -744,9 +756,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7"
[[package]]
name = "log"
@ -814,13 +826,13 @@ dependencies = [
[[package]]
name = "mio"
version = "0.7.9"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a"
checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956"
dependencies = [
"libc",
"log 0.4.14",
"miow 0.3.6",
"miow 0.3.7",
"ntapi",
"winapi 0.3.9",
]
@ -851,11 +863,10 @@ dependencies = [
[[package]]
name = "miow"
version = "0.3.6"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"socket2",
"winapi 0.3.9",
]
@ -944,6 +955,12 @@ dependencies = [
"libc",
]
[[package]]
name = "once_cell"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
[[package]]
name = "opaque-debug"
version = "0.3.0"
@ -952,15 +969,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openssl"
version = "0.10.32"
version = "0.10.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"foreign-types",
"lazy_static",
"libc",
"once_cell",
"openssl-sys",
]
@ -972,9 +989,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-sys"
version = "0.9.60"
version = "0.9.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
dependencies = [
"autocfg",
"cc",
@ -1001,7 +1018,7 @@ dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"syn 0.15.44",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@ -1034,7 +1051,7 @@ checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.63",
"syn 1.0.64",
]
[[package]]
@ -1210,7 +1227,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"time 0.2.25",
"time 0.2.26",
"tokio",
"tokio-native-tls",
"url 2.2.1",
@ -1235,9 +1252,9 @@ dependencies = [
"rocket_codegen",
"rocket_http",
"state",
"time 0.1.43",
"time 0.1.44",
"toml",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@ -1252,7 +1269,7 @@ dependencies = [
"indexmap",
"quote 0.6.13",
"rocket_http",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@ -1282,21 +1299,10 @@ dependencies = [
"percent-encoding 1.0.1",
"smallvec",
"state",
"time 0.1.43",
"time 0.1.44",
"unicode-xid 0.1.0",
]
[[package]]
name = "rust-api"
version = "0.1.0"
dependencies = [
"chrono",
"reqwest",
"rocket",
"rocket_contrib",
"serde",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
@ -1377,22 +1383,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.124"
version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f"
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.124"
version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b"
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.63",
"syn 1.0.64",
]
[[package]]
@ -1462,11 +1468,11 @@ dependencies = [
[[package]]
name = "standback"
version = "0.2.15"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8"
checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff"
dependencies = [
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@ -1499,7 +1505,7 @@ dependencies = [
"quote 1.0.9",
"serde",
"serde_derive",
"syn 1.0.63",
"syn 1.0.64",
]
[[package]]
@ -1515,7 +1521,7 @@ dependencies = [
"serde_derive",
"serde_json",
"sha1",
"syn 1.0.63",
"syn 1.0.64",
]
[[package]]
@ -1543,9 +1549,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.63"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717"
checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
@ -1568,26 +1574,27 @@ dependencies = [
[[package]]
name = "time"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi",
"winapi 0.3.9",
]
[[package]]
name = "time"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1195b046942c221454c2539395f85413b33383a067449d78aab2b7b052a142f7"
checksum = "08a8cbfbf47955132d0202d1662f49b2423ae35862aee471f3ba4b133358f372"
dependencies = [
"const_fn",
"libc",
"standback",
"stdweb",
"time-macros",
"version_check 0.9.2",
"version_check 0.9.3",
"winapi 0.3.9",
]
@ -1611,7 +1618,7 @@ dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"standback",
"syn 1.0.63",
"syn 1.0.64",
]
[[package]]
@ -1631,15 +1638,15 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda"
checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
"mio 0.7.9",
"mio 0.7.11",
"num_cpus",
"pin-project-lite",
]
@ -1656,9 +1663,9 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.6.4"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29"
checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f"
dependencies = [
"bytes",
"futures-core",
@ -1723,9 +1730,9 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
[[package]]
name = "typenum"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
[[package]]
name = "unicase"
@ -1813,15 +1820,15 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
name = "version_check"
version = "0.9.2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "walkdir"
version = "2.3.1"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
"same-file",
"winapi 0.3.9",
@ -1840,15 +1847,15 @@ dependencies = [
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.71"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
dependencies = [
"cfg-if 1.0.0",
"serde",
@ -1858,24 +1865,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.71"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8"
checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
dependencies = [
"bumpalo",
"lazy_static",
"log 0.4.14",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.63",
"syn 1.0.64",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.21"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab"
checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
@ -1885,9 +1892,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.71"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b"
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
dependencies = [
"quote 1.0.9",
"wasm-bindgen-macro-support",
@ -1895,28 +1902,28 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.71"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.63",
"syn 1.0.64",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.71"
version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"
[[package]]
name = "web-sys"
version = "0.3.48"
version = "0.3.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310"
dependencies = [
"js-sys",
"wasm-bindgen",

View File

@ -1,6 +1,6 @@
[package]
name = "rust-api"
version = "0.1.0"
name = "fej"
version = "0.0.1"
authors = ["Jef Roosens <roosensjef@gmail.com>"]
edition = "2018"

View File

@ -1,34 +1,32 @@
FROM rust:alpine AS builder
# We use a multi-stage build to end up with a very small final image
FROM alpine:latest AS builder
# Switch to the nightly build
RUN rustup default nightly
ENV PATH "$PATH:/root/.cargo/bin"
WORKDIR /usr/src/app
# Install build dependencies & create a new dummy project
# that we use as a build cache
RUN apk update && \
apk add --no-cache openssl openssl-dev musl-dev && \
cargo init --bin
# Install build dependencies, rustup & rust's nightly build & toolchain
RUN apk update && apk add --no-cache openssl-dev build-base curl && \
{ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; }
# Build the dependencies
# This is done separately to reduce average compile time
# Afterwards, we remove the dummy src directory
# Copy source code over to builder
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release && \
rm src/*.rs
COPY src/ ./src/
# Now, we build our own source code
COPY src/ ./src
RUN cargo install --path .
# Finally, build the project
# Thank the lords that this article exists
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
# TODO add what these flags do & why they work
RUN RUSTFLAGS="-C target-feature=-crt-static" cargo build --release
# Now, we create the actual image
FROM alpine:latest
# Install dependencies
RUN apk update && apk add --no-cache openssl
# Install some dynamic libraries needed for everything to work
RUN apk update && apk add --no-cache openssl libgcc
COPY --from=builder /usr/local/cargo/bin/rust-api /usr/local/bin/rust-api
# Copy binary over to final image
COPY --from=builder /usr/src/app/target/release/fej /usr/local/bin/fej
CMD ["rust-api"]
CMD ["/usr/local/bin/fej"]

View File

@ -1,5 +1,4 @@
IMAGE := rust-api:latest
shell := /bin/bash
IMAGE := chewingbever/fej
all: debug
@ -15,9 +14,12 @@ release:
.PHONY: release
image: Dockerfile
@ docker build -t '$(IMAGE)' .
@ ./build '$(IMAGE)'
.PHONY: image
push:
@ ./build '$(IMAGE)' push
.PHONY: push
# Run
run:

55
build 100755
View File

@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Simple guard to check input args
[[ $# -eq 1 ]] || [[ $# -eq 2 ]] || {
>&2 echo "Usage: ./build IMAGE [ACTION]"
exit 1
}
# Extract current version from Cargo.toml & get current branch
patch_version="$(grep -Po '(?<=version = ").*(?=")' Cargo.toml | head -n1)"
major_version="$(echo "$patch_version" |
sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/')"
minor_version="$(echo "$patch_version" |
sed -E 's/([0-9]+).([0-9]+).([0-9]+)/\1.\2/')"
branch="$(git branch --show-current)"
if [[ "$branch" = "master" ]]; then
tags=("$patch_version" "$minor_version" "$major_version" "latest")
elif [[ "$branch" = "develop" ]]; then
tags=("$patch_version-dev" "$minor_version-dev" "$major_version-dev" "dev")
else
tags=("$branch")
fi
# Run the actual build command
docker build -t "$1:$tags" .
if [[ "$2" = push ]]; then
[[ "$branch" =~ ^develop|master$ ]] || {
>&2 echo "You can only push from develop or master."
exit 2
}
for tag in "${tags[@]}"; do
# Create the tag
docker tag "$1:$tags" "$1:$tag"
# Push the tag
docker push "$1:$tag"
# Remove the tag again, if it's not the main tag
[[ "$tag" != "$tags" ]] && docker rmi "$1:$tag"
done
elif [[ "$2" = run ]]; then
docker run \
--rm \
--interactive \
--tty \
--publish 8000:8000 \
"$1:$tags"
fi