Spaces:
Sleeping
Sleeping
# Use Ubuntu 20.04 as the base image | |
FROM ubuntu:20.04 | |
# Install curl to download code-server | |
RUN apt-get update && apt-get install -y curl | |
# Download and install code-server | |
RUN curl -fsSL https://code-server.dev/install.sh | sh | |
# Set the default port for code-server | |
ENV PORT=8081 | |
# Set PASSWORD | |
ENV PASSWORD=password | |
# Create a non-root user with sudo privileges | |
RUN useradd -ms /bin/bash newuser && \ | |
echo 'newuser:newpassword' | chpasswd && \ | |
usermod -aG sudo newuser && \ | |
echo 'newuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
# Expose the code-server port | |
EXPOSE 8081 | |
# Switch to the non-root user | |
USER newuser | |
# Start code-server on container startup | |
CMD ["code-server", "--auth", "password", "--host", "0.0.0.0"] |