forked from DevYukine/red_oxide
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
39 lines (37 loc) · 1.1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Build imdl binary
FROM rust:alpine AS imdl
RUN apk add --no-cache curl
RUN curl "https://github.com/casey/intermodal/releases/download/v0.1.14/imdl-v0.1.14-x86_64-unknown-linux-musl.tar.gz" \
--location \
--show-error \
--silent \
--connect-timeout 2 \
--max-time 30 \
| tar \
--extract \
--gzip \
--directory "/bin" \
--file - \
"imdl"
# Build caesura binary
FROM rust:alpine AS builder
RUN apk add --no-cache libc-dev cargo-edit
# Build just the dependencies with version 0.0.0 so they're cached
WORKDIR /app
COPY Cargo.toml Cargo.lock build.rs /app
RUN mkdir -p src && echo 'fn main() {}' > /app/src/main.rs
RUN cargo fetch
RUN cargo build --release --locked
# Set the version
COPY . /app
ARG VERSION=0.0.0
RUN cargo set-version $VERSION
# Build the release binary
RUN cargo build --release
# Build final image with minimal dependencies
FROM alpine:latest
RUN apk add --no-cache flac lame sox imagemagick imagemagick-jpeg eyed3
COPY --from=imdl /bin/imdl /bin/imdl
COPY --from=builder /app/target/release/caesura /bin/caesura
WORKDIR /
ENTRYPOINT ["caesura"]