Skip to content

Commit

Permalink
fix many things
Browse files Browse the repository at this point in the history
  • Loading branch information
DoyunShin committed May 2, 2024
1 parent fffcf1a commit c301698
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ cython_debug/
#.idea/

settings.py
newbie/
newbie/
home/
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM ubuntu:24.04

# Install dependencies
RUN sed -i 's/archive.ubuntu.com/ftp.kaist.ac.kr/g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's/security.ubuntu.com/ftp.kaist.ac.kr/g' /etc/apt/sources.list.d/ubuntu.sources

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
git \
vim \
Expand All @@ -10,17 +13,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
openssh-server \
sudo

RUN useradd -ms /bin/bash sparcs && adduser sparcs sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER sparcs
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

RUN echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ~/.bashrc
RUN useradd -m -s /bin/bash sparcs && \
chown -R sparcs:sparcs /home/sparcs && \
adduser sparcs sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
echo 'Banner /etc/banner' >> /etc/ssh/sshd_config
RUN su - sparcs -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash'
RUN tar czf /sparcs-home.tar.gz /home/sparcs

USER root
ADD docker-entrypoint.sh /docker-entrypoint.sh
ADD banner /etc/banner
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
7 changes: 7 additions & 0 deletions banner
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

███████╗██████╗ █████╗ ██████╗ ██████╗███████╗
██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔════╝
███████╗██████╔╝███████║██████╔╝██║ ███████╗
╚════██║██╔═══╝ ██╔══██║██╔══██╗██║ ╚════██║
███████║██║ ██║ ██║██║ ██║╚██████╗███████║
╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ services:
- "15000:22"
- "15001:3000"
- "15002:8000"
volumes:
- "./home:/home/sparcs"
#volumes:
# - "./home:/home/sparcs"
environment:
- NEW_PASSWORD=1234
depends_on:
Expand Down
3 changes: 3 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh

echo "sparcs:$NEW_PASSWORD" | chpasswd
if [ -f /home/sparcs/.profile ]; then
tar xvf /sparcs-home.tar.gz -C /home/sparcs
fi
mkdir -p /var/run/sshd
/usr/sbin/sshd -D
tail -f /dev/null

0 comments on commit c301698

Please sign in to comment.