Add first Docker image

Davide Polonio 2021-09-22 16:08:30 +02:00
parent 0ba77b0aa6
commit 10040d1f39
3 changed files with 20 additions and 9 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
target/
.idea/

17
Dockerfile Normal file
View File

@ -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

View File

@ -1,5 +1,5 @@
use crate::SpotifyURL::Track;
use aspotify::{Client, ClientCredentials, Market};
use aspotify::{Client, ClientCredentials};
use teloxide::prelude::*;
enum SpotifyURL {
@ -17,14 +17,6 @@ fn get_spotify_entry(url: &str) -> Option<SpotifyURL> {
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 {
name: String,
artist: Vec<String>,