-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.74 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
# Use an official Ubuntu as a parent image
FROM ubuntu:22.04
# Set the working directory in the container
WORKDIR /usr/src/tmp
# Set bash as the default shell with pipefail option
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Update apt repository and install required packages
RUN apt-get update && \
apt-get install -y curl python3 python3-pip zsh git sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Starship for a fancy shell prompt
RUN curl -sS https://starship.rs/install.sh | sh -s -- -y
# Install Open Interpreter via pip
RUN pip3 install --no-cache-dir open-interpreter
# Add a new user 'developer', give sudo privileges, and set up user environment
RUN useradd -m -s /usr/bin/zsh developer && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer
# Change to the new user
USER developer
# Set up user-specific configurations
RUN mkdir -p /home/developer/.config/ && \
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions /home/developer/.config/zsh-autosuggestions && \
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git /home/developer/.config/zsh-syntax-highlighting
# Copy configuration files into the developer's home directory
COPY zshrc /home/developer/.zshrc
COPY starship.toml /home/developer/.config/starship.toml
# Change ownership of the copied files to the new user
USER root
RUN chown -R developer:developer /home/developer
USER developer
# Create a keep-alive script
RUN printf '#!/bin/bash\ntrap "exit 0" SIGTERM SIGINT\nwhile true; do sleep 1; done' > /home/developer/keepalive.sh && \
chmod +x /home/developer/keepalive.sh
# Set the keep-alive script as the default command
CMD ["/home/developer/keepalive.sh"]