Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -6
Dockerfile
CHANGED
@@ -4,20 +4,21 @@ FROM python:3.10-slim
|
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Install dependencies: wget,
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
wget \
|
10 |
apt-transport-https \
|
11 |
gnupg2 \
|
12 |
unzip \
|
13 |
-
|
14 |
-
&& apt-get install -y python3-pip \
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
-
#
|
18 |
-
RUN
|
|
|
|
|
19 |
|
20 |
-
#
|
21 |
ENV PATH="/usr/local/roslyn/Microsoft.Net.Compilers.4.0.1/tools:${PATH}"
|
22 |
|
23 |
# Create a non-root user and set it as the user for the rest of the image
|
@@ -29,6 +30,18 @@ RUN chown -R appuser:appuser /app
|
|
29 |
# Switch to the non-root user
|
30 |
USER appuser
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Copy the requirements file with the correct owner
|
33 |
COPY --chown=appuser:appuser ./requirements.txt /app/requirements.txt
|
34 |
|
|
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install dependencies: wget, unzip, and Python pip
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
wget \
|
10 |
apt-transport-https \
|
11 |
gnupg2 \
|
12 |
unzip \
|
13 |
+
python3-pip \
|
|
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
+
# Download and install Roslyn
|
17 |
+
RUN wget https://github.com/dotnet/roslyn/releases/download/v4.0.1/roslyn.zip \
|
18 |
+
&& unzip roslyn.zip -d /usr/local/roslyn \
|
19 |
+
&& rm roslyn.zip
|
20 |
|
21 |
+
# Set the PATH for the Roslyn compiler
|
22 |
ENV PATH="/usr/local/roslyn/Microsoft.Net.Compilers.4.0.1/tools:${PATH}"
|
23 |
|
24 |
# Create a non-root user and set it as the user for the rest of the image
|
|
|
30 |
# Switch to the non-root user
|
31 |
USER appuser
|
32 |
|
33 |
+
# Create necessary directories and set permissions
|
34 |
+
RUN mkdir -p /app/uploads /home/appuser/.mono && \
|
35 |
+
chmod -R 777 /app/uploads /home/appuser/.mono
|
36 |
+
|
37 |
+
# Set the MONO_HOME environment variable
|
38 |
+
ENV MONO_HOME="/home/appuser/.mono"
|
39 |
+
# Add the Mono tools directory to PATH
|
40 |
+
ENV PATH="${PATH}:${MONO_HOME}/bin:/usr/bin"
|
41 |
+
|
42 |
+
# Verify that csc is installed
|
43 |
+
RUN which csc
|
44 |
+
|
45 |
# Copy the requirements file with the correct owner
|
46 |
COPY --chown=appuser:appuser ./requirements.txt /app/requirements.txt
|
47 |
|