-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.old
90 lines (73 loc) · 2.96 KB
/
Dockerfile.old
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Build image
# Necessary dependencies to build CrackTunes
FROM rust:slim-bookworm AS builder
#ARG SQLX_OFFLINE=true
#libssl-dev \
# autoconf \
# automake \
#RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y \
cmake \
libtool \
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 nightly
WORKDIR "/app"
COPY . .
# COPY names.txt /app/names.txt
# RUN . "$HOME/.cargo/env" && cargo build --profile=release-with-preformance --locked --features crack-bf,crack-gpt,crack-osint
RUN cargo build --no-default-features --features crack-tracing -p cracktunes --release
# Release image
# Necessary dependencies to run CrackTunes
FROM debian:bookworm-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
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y ffmpeg curl \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# RUN curl -sSL --output /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/download/latest/yt-dlp_linux \
# && chmod +x /usr/local/bin/yt-dlp
# USER $USERNAME
# 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
# COPY --chown=${USER_UID}:${USER_GID} --from=build /app/names.txt $HOME/app/names.txt
# # RUN ls -al / && ls -al /data
# # RUN . "$HOME/app/.env"
# ENV APP_ENVIRONMENT=production
# ENV DATABASE_URL=postgresql://postgres:mysecretpassword@localhost:5432/postgres
# CMD ["/home/cyclefive/app/cracktunes"]
ADD ./data /data
RUN curl -sSL --output /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux \
&& chmod +x /usr/local/bin/yt-dlp
# Copy the binary from the builder stage
COPY --from=builder /app/target/release/cracktunes /app/app
# Copy the start script from the builder stage
COPY --from=builder /app/scripts/start.sh /app/start.sh
CMD ["/app/start.sh"]