Add first Docker image
parent
0ba77b0aa6
commit
10040d1f39
|
@ -0,0 +1,2 @@
|
||||||
|
target/
|
||||||
|
.idea/
|
|
@ -0,0 +1,17 @@
|
||||||
|
FROM rust:1.55.0-alpine3.14 as builder
|
||||||
|
|
||||||
|
ENV RUSTFLAGS="-C target-feature=+crt-static"
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
RUN apk add --no-cache musl-dev \
|
||||||
|
openssl-dev \
|
||||||
|
build-base
|
||||||
|
|
||||||
|
COPY ./ /build
|
||||||
|
RUN cargo build --target x86_64-unknown-linux-musl --release # --verbose && ls -lah /build/target/release/build/ && ls -lah .
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/static
|
||||||
|
|
||||||
|
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/songlify /usr/bin/songlify
|
||||||
|
|
||||||
|
ENTRYPOINT /usr/bin/songlify
|
10
src/main.rs
10
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
use crate::SpotifyURL::Track;
|
use crate::SpotifyURL::Track;
|
||||||
use aspotify::{Client, ClientCredentials, Market};
|
use aspotify::{Client, ClientCredentials};
|
||||||
use teloxide::prelude::*;
|
use teloxide::prelude::*;
|
||||||
|
|
||||||
enum SpotifyURL {
|
enum SpotifyURL {
|
||||||
|
@ -17,14 +17,6 @@ fn get_spotify_entry(url: &str) -> Option<SpotifyURL> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_spotify_url(url: &str) -> Option<&str> {
|
|
||||||
// https://open.spotify.com/track/0VffaI2jwQknRrxpECYHsF?si=1e16c64779744375
|
|
||||||
if url.contains("https://open.spotify.com/") {
|
|
||||||
return Some(url);
|
|
||||||
}
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TrackInfo {
|
struct TrackInfo {
|
||||||
name: String,
|
name: String,
|
||||||
artist: Vec<String>,
|
artist: Vec<String>,
|
||||||
|
|
Loading…
Reference in New Issue