-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
FROM debian:stretch-slim AS build | ||
FROM rust:slim AS build | ||
MAINTAINER Ivan <ivan@zderadicka.eu> | ||
|
||
ARG FEATURES | ||
|
||
RUN apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update &&\ | ||
apt-get install -y pkg-config openssl libssl-dev libtag1-dev libtagc0-dev curl yasm build-essential wget libbz2-dev zlib1g-dev &&\ | ||
curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\ | ||
apt-get install -y nodejs | ||
|
||
COPY . /audioserve_src | ||
|
||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
|
||
RUN mkdir ffmpeg-static &&\ | ||
curl -sL https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | tar xJv -C ffmpeg-static --strip-components=1 --wildcards "*/ffmpeg" &&\ | ||
cp /ffmpeg-static/ffmpeg /usr/bin | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
curl \ | ||
libbz2-dev \ | ||
libssl1.0-dev \ | ||
libtag1-dev \ | ||
libtagc0-dev \ | ||
openssl \ | ||
pkg-config \ | ||
yasm && \ | ||
mkdir ffmpeg-static && \ | ||
curl -sL https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | \ | ||
tar xJv -C ffmpeg-static --strip-components=1 --wildcards "*/ffmpeg" && \ | ||
mv /ffmpeg-static/ffmpeg /usr/bin/ffmpeg | ||
|
||
WORKDIR /src | ||
COPY Cargo.toml Cargo.lock /src/ | ||
# To cache this step, we only copy the toml file above | ||
RUN cargo fetch | ||
|
||
COPY . /src | ||
|
||
RUN cargo build --release ${FEATURES} && \ | ||
cargo test --release ${FEATURES} | ||
|
||
FROM node:8-alpine as frontend | ||
|
||
RUN export PATH=${HOME}/.cargo/bin:$PATH &&\ | ||
cd audioserve_src &&\ | ||
cargo build --release ${FEATURES} &&\ | ||
cargo test --release ${FEATURES} | ||
WORKDIR /src | ||
COPY client /src | ||
|
||
RUN cd audioserve_src/client &&\ | ||
npm install &&\ | ||
RUN npm install && \ | ||
npm run build | ||
|
||
RUN mkdir /ssl &&\ | ||
cd /ssl &&\ | ||
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem \ | ||
-subj "/C=CZ/ST=Prague/L=Prague/O=Ivan/CN=audioserve" &&\ | ||
openssl pkcs12 -inkey key.pem -in certificate.pem -export -passout pass:mypass -out audioserve.p12 | ||
|
||
FROM debian:stretch-slim | ||
|
||
VOLUME /audiobooks | ||
COPY --from=build /audioserve_src/target/release/audioserve /audioserve/audioserve | ||
COPY --from=build /audioserve_src/client/dist /audioserve/client/dist | ||
COPY --from=build /ssl/audioserve.p12 /audioserve/ssl/audioserve.p12 | ||
COPY --from=frontend /audioserve_src/client/dist /audioserve/client/dist | ||
COPY --from=build /ffmpeg-static/ffmpeg /usr/bin | ||
|
||
RUN adduser audioserve &&\ | ||
chown -R audioserve:audioserve /audioserve &&\ | ||
apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update &&\ | ||
RUN adduser audioserve && \ | ||
chown -R audioserve:audioserve /audioserve && \ | ||
apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update && \ | ||
apt-get install -y libssl1.1 libtag1v5 libtagc0 libbz2-1.0 | ||
|
||
WORKDIR /audioserve | ||
USER audioserve | ||
|
||
ENV SECRET=mypass | ||
ENV SSLKEY=./ssl/audioserve.p12 | ||
ENV SSLPASS=mypass | ||
ENV DIRS=/audiobooks | ||
ENV PORT=3000 | ||
|
||
EXPOSE ${PORT} | ||
|
||
COPY audioserve.sh . | ||
|
||
CMD ./audioserve.sh | ||
ENTRYPOINT ["/audioserve/audioserve"] | ||
CMD ["/audiobooks"] |
This file was deleted.
Oops, something went wrong.