-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.unstable
75 lines (61 loc) · 2.32 KB
/
Dockerfile.unstable
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Build image
# Necessary dependencies to build CrackTunes
FROM debian:unstable-slim as build
ARG SQLX_OFFLINE=true
RUN apt-get update && apt-get install -y \
autoconf \
automake \
cmake \
libtool \
libssl-dev \
pkg-config \
libopus-dev \
curl \
git
# Get Rust
RUN curl -proto '=https' -tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& . "$HOME/.cargo/env" \
&& rustup default stable
WORKDIR "/app"
COPY . .
RUN . "$HOME/.cargo/env" && cargo build --release --locked
# Release image
# Necessary dependencies to run CrackTunes
FROM debian:unstable-slim AS runtime
ARG USERNAME=cyclefive
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ENV HOME=/home/${USERNAME}
VOLUME [ "/data" ]
RUN mkdir -p /data && chown -R ${USER_UID}:${USER_GID} /data
# VOLUME [ "/var/lib/postgresql/data" ]
# Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
RUN sudo apt-get update \
# && apt-get upgrade -y \
&& sudo apt-get install -y ffmpeg curl \
# Clean up
&& sudo apt-get autoremove -y \
&& sudo apt-get clean -y \
&& sudo rm -rf /var/lib/apt/lists/*
RUN sudo curl -sSL --output /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/download/latest/yt-dlp_linux \
&& sudo chmod +x /usr/local/bin/yt-dlp
#RUN yt-dlp -v -h
# USER 1000
WORKDIR "${HOME}/app"
COPY --chown=${USER_UID}:${USER_GID} --from=build /app/target/release/cracktunes $HOME/app/cracktunes
COPY --chown=${USER_UID}:${USER_GID} --from=build /app/data $HOME/app/data
#COPY --chown=${USER_UID}:${USER_GID} --from=build /app/.env.example $HOME/app/.env
#COPY --chown=${USER_UID}:${USER_GID} --from=build /app/cracktunes.toml $HOME/app/cracktunes.toml
# RUN ls -al / && ls -al /data
ENV APP_ENVIRONMENT production
ENV DATABASE_URL "postgresql://FIXME:FIXME@localhost/postgres"
CMD ["/home/cyclefive/app/cracktunes"]