Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -29
Dockerfile
CHANGED
|
@@ -1,48 +1,28 @@
|
|
| 1 |
-
# Base image
|
| 2 |
FROM ubuntu:22.04
|
| 3 |
-
|
| 4 |
-
# Prevent interactive prompts during build
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
|
| 7 |
-
#
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
curl ca-certificates git wget sudo \
|
| 10 |
-
python3 python3-pip
|
| 11 |
-
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 16 |
-
apt-get install -y nodejs
|
| 17 |
-
|
| 18 |
-
# 3. Install MySQL Server
|
| 19 |
-
RUN apt-get update && apt-get install -y mysql-server \
|
| 20 |
-
&& rm -rf /var/lib/apt/lists/* \
|
| 21 |
-
&& mkdir -p /var/run/mysqld && chown mysql:mysql /var/run/mysqld
|
| 22 |
-
|
| 23 |
-
# 4. Install code-server
|
| 24 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 25 |
|
| 26 |
-
#
|
| 27 |
RUN useradd -m -s /bin/bash coder && \
|
| 28 |
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
RUN mkdir -p /
|
| 33 |
-
&& mkdir -p /data/mysql \
|
| 34 |
-
&& chown -R coder:coder /home/coder \
|
| 35 |
-
&& chown -R mysql:mysql /data/mysql
|
| 36 |
|
| 37 |
-
#
|
| 38 |
COPY start.sh /usr/local/bin/start.sh
|
| 39 |
RUN chmod +x /usr/local/bin/start.sh
|
| 40 |
|
| 41 |
-
# Switch to root to allow start.sh to fix permissions on startup
|
| 42 |
USER root
|
| 43 |
-
|
| 44 |
-
# Expose port
|
| 45 |
EXPOSE 7860
|
| 46 |
-
|
| 47 |
-
# Start!
|
| 48 |
CMD ["/usr/local/bin/start.sh"]
|
|
|
|
|
|
|
| 1 |
FROM ubuntu:22.04
|
|
|
|
|
|
|
| 2 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 3 |
|
| 4 |
+
# Install dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
curl ca-certificates git wget sudo \
|
| 7 |
+
python3 python3-pip python-is-python3 \
|
| 8 |
+
mysql-server \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Install code-server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 13 |
|
| 14 |
+
# Setup users
|
| 15 |
RUN useradd -m -s /bin/bash coder && \
|
| 16 |
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 17 |
|
| 18 |
+
# Setup directories
|
| 19 |
+
RUN mkdir -p /home/coder/projects && chown -R coder:coder /home/coder
|
| 20 |
+
RUN mkdir -p /var/run/mysqld && chown -R mysql:mysql /var/run/mysqld
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
# Copy and run script
|
| 23 |
COPY start.sh /usr/local/bin/start.sh
|
| 24 |
RUN chmod +x /usr/local/bin/start.sh
|
| 25 |
|
|
|
|
| 26 |
USER root
|
|
|
|
|
|
|
| 27 |
EXPOSE 7860
|
|
|
|
|
|
|
| 28 |
CMD ["/usr/local/bin/start.sh"]
|