-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile
56 lines (40 loc) · 1.44 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# check=error=true
ARG CARGO_ARGS
ARG CARGO_RELEASE="release"
FROM alpine:3.19 AS build
LABEL maintainer="Ivan <[email protected]>"
ARG CARGO_ARGS
ARG CARGO_RELEASE
RUN apk update &&\
apk add git bash curl yasm build-base pkgconfig \
wget libbz2 bzip2-dev zlib zlib-dev rust cargo ffmpeg-dev ffmpeg \
clang clang-dev gawk ctags llvm-dev icu icu-libs icu-dev
COPY . /audioserve
WORKDIR /audioserve
RUN if [[ -n "$CARGO_RELEASE" ]]; then CARGO_RELEASE="--$CARGO_RELEASE"; fi && \
echo BUILDING: cargo build ${CARGO_RELEASE} ${CARGO_ARGS} && \
cargo build ${CARGO_RELEASE} ${CARGO_ARGS} &&\
cargo test ${CARGO_RELEASE} --all ${CARGO_ARGS}
FROM node:20-alpine AS client
RUN apk add git &&\
git clone https://github.com/izderadicka/audioserve-web.git /audioserve_client &&\
cd /audioserve_client &&\
npm install &&\
npm run build-sw &&\
npm run build &&\
./compress_dist.sh
FROM alpine:3.19
ARG CARGO_ARGS
ARG CARGO_RELEASE
COPY --from=build /audioserve/target/${CARGO_RELEASE:-debug}/audioserve /audioserve/audioserve
COPY --from=client /audioserve_client/dist /audioserve/client/dist
RUN adduser -D -u 1000 audioserve &&\
chown -R audioserve:audioserve /audioserve &&\
apk --no-cache add libbz2 zlib ffmpeg && \
if [[ "$CARGO_ARGS" =~ "collation" ]]; then apk --no-cache add icu-libs; fi
WORKDIR /audioserve
USER audioserve
ENV PORT=3000
ENV RUST_LOG=info
EXPOSE ${PORT}
ENTRYPOINT [ "./audioserve" ]