Update Dockerfile
Browse files- Dockerfile +12 -10
Dockerfile
CHANGED
@@ -8,26 +8,28 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
8 |
# Set working directory
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
# Install
|
12 |
COPY ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Copy project files
|
16 |
COPY . /app
|
17 |
|
18 |
-
#
|
19 |
-
RUN apt-get update && apt-get install -y curl
|
20 |
-
|
21 |
-
# Add sshx install and run to start.sh
|
22 |
RUN echo '#!/bin/bash\n' \
|
23 |
-
'
|
24 |
-
'./sshx run &\n' \
|
25 |
'exec uvicorn main:app --host 0.0.0.0 --port 7860' \
|
26 |
> /app/start.sh && chmod +x /app/start.sh
|
27 |
|
28 |
-
|
29 |
-
# Use non-root user
|
30 |
USER user
|
31 |
|
32 |
-
# Run app
|
33 |
CMD ["bash", "start.sh"]
|
|
|
8 |
# Set working directory
|
9 |
WORKDIR /app
|
10 |
|
11 |
+
# Install dependencies
|
12 |
COPY ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
15 |
+
# Install curl for sshx
|
16 |
+
RUN apt-get update && apt-get install -y curl
|
17 |
+
|
18 |
+
# Download sshx manually and place it in /usr/local/bin
|
19 |
+
RUN curl -sSfL https://s3.amazonaws.com/sshx/sshx-x86_64-unknown-linux-musl.tar.gz | \
|
20 |
+
tar -xz -C /usr/local/bin && chmod +x /usr/local/bin/sshx
|
21 |
+
|
22 |
# Copy project files
|
23 |
COPY . /app
|
24 |
|
25 |
+
# Create startup script
|
|
|
|
|
|
|
26 |
RUN echo '#!/bin/bash\n' \
|
27 |
+
'sshx run &\n' \
|
|
|
28 |
'exec uvicorn main:app --host 0.0.0.0 --port 7860' \
|
29 |
> /app/start.sh && chmod +x /app/start.sh
|
30 |
|
31 |
+
# Switch to non-root user
|
|
|
32 |
USER user
|
33 |
|
34 |
+
# Run the app
|
35 |
CMD ["bash", "start.sh"]
|