forked from MoreTore/connect-killer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (55 loc) · 1.84 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
57
58
59
60
61
62
63
64
65
66
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04
# Set the environment to noninteractive to avoid prompts
ENV DEBIAN_FRONTEND=noninteractive
# Update and install dependencies in one RUN command
RUN apt-get update && apt-get install -y \
build-essential \
clang \
curl \
wget \
cron \
libpq-dev \
libssl-dev \
pkg-config \
libavutil-dev \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \
capnproto \
nodejs \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- --default-toolchain 1.82.0 -y
# Ensure that the Rust environment is available in the current session
ENV PATH="/root/.cargo/bin:${PATH}"
# Set up a Cargo cache directory
ENV CARGO_HOME=/usr/local/cargo
RUN mkdir -p $CARGO_HOME
VOLUME $CARGO_HOME
# Set the working directory
WORKDIR /usr/src/connect
# Copy the Cargo.toml and source code
COPY . .
# Install Python packages
RUN pip3 install -U "huggingface_hub[cli,hf_transfer]"
RUN pip3 install --no-cache-dir -r fetch/requirements.txt
# Load NVM and install Node.js
RUN /bin/bash -c "./install_deps.sh"
# Build the application with necessary features
RUN /bin/bash -c "source $HOME/.cargo/env && export RUST_MIN_STACK=134217728 && cargo install loco-cli cargo-insta sea-orm-cli"
RUN /bin/bash -c "source $HOME/.cargo/env && export RUST_MIN_STACK=134217728 && cargo build --release"
# Setup cronjob for deleting old files
RUN echo "0 * * * * cd /usr/src/connect && ./target/release/connect-cli task deleter >> /var/log/cron.log 2>&1" > /etc/cron.d/connect-cron
RUN chmod 0644 /etc/cron.d/connect-cron
RUN crontab /etc/cron.d/connect-cron
# Expose the ports your server runs on
# HTTPS
EXPOSE 3222
EXPOSE 3223
# HTTP
EXPOSE 3111
EXPOSE 3112
CMD ./start_connect.sh & ./start_useradmin.sh & wait