use SSH to connect to container now
This commit is contained in:
parent
127bfa0d8b
commit
90406677b8
2 changed files with 15 additions and 6 deletions
16
Dockerfile
16
Dockerfile
|
@ -16,14 +16,22 @@ RUN echo Include = /etc/pacman.d/devkitpro.conf >> /etc/pacman.conf
|
||||||
RUN pacman -Syu --noconfirm
|
RUN pacman -Syu --noconfirm
|
||||||
|
|
||||||
# install tools
|
# install tools
|
||||||
RUN pacman -Sy --noconfirm base-devel $TOOLS
|
RUN pacman -Sy --noconfirm base-devel openssh $TOOLS
|
||||||
|
|
||||||
# setup environment
|
# setup environment
|
||||||
RUN groupadd -g $GID devkitpro
|
RUN groupadd -g $GID devkitpro
|
||||||
RUN useradd -u $UID -g $GID -MN devkitpro
|
RUN useradd -u $UID -g $GID -mN devkitpro
|
||||||
|
RUN ssh-keygen -A
|
||||||
|
RUN sed -i "s|#Port 22|Port 2222|g" /etc/ssh/sshd_config
|
||||||
|
RUN chown devkitpro:devkitpro /etc/ssh/ssh_host*
|
||||||
|
RUN mkdir /home/devkitpro/.ssh
|
||||||
|
RUN --mount=type=secret,id=key,target=/root/id.pub \
|
||||||
|
cp /root/id.pub /home/devkitpro/.ssh/authorized_keys
|
||||||
|
RUN chown devkitpro -R /home/devkitpro
|
||||||
USER devkitpro
|
USER devkitpro
|
||||||
WORKDIR /volume
|
WORKDIR /volume
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
RUN echo cd /volume >> /home/devkitpro/.bashrc
|
||||||
|
EXPOSE 2222/tcp
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
# use docker exec to access container OR
|
# use docker exec to access container OR
|
||||||
# use docker compose to specify entrypoint
|
# use docker compose to specify entrypoint
|
||||||
|
|
||||||
|
|
5
build
5
build
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
uid=$(id -u)
|
uid=$(id -u)
|
||||||
gid=$(id -g)
|
gid=$(id -g)
|
||||||
|
key=$HOME/.ssh/id_rsa.pub
|
||||||
kits=(gp32-dev gp2x-dev gba-dev nds-dev 3ds-dev gamecube-dev wii-dev wiiu-dev switch-dev)
|
kits=(gp32-dev gp2x-dev gba-dev nds-dev 3ds-dev gamecube-dev wii-dev wiiu-dev switch-dev)
|
||||||
|
|
||||||
for kit in ${kits[@]}; do
|
for kit in ${kits[@]}; do
|
||||||
echo building $kit...
|
echo building $kit...
|
||||||
docker build -t devkitpro:$(echo $kit | sed "s|-dev||") --build-arg TOOLS="$kit" --build-arg UID=$uid --build-arg GID=$gid .
|
docker build -t devkitpro:$(echo $kit | sed "s|-dev||") --build-arg TOOLS="$kit" --build-arg UID=$uid --build-arg GID=$gid --secret id=key,src=$key .
|
||||||
done
|
done
|
||||||
|
|
||||||
echo building all devkits...
|
echo building all devkits...
|
||||||
docker build -t devkitpro:all --build-arg TOOLS="$(echo "${kits[@]}")" --build-arg UID=$uid --build-arg GID=$gid .
|
docker build -t devkitpro:all --build-arg TOOLS="$(echo "${kits[@]}")" --build-arg UID=$uid --build-arg GID=$gid --secret id=key,src=$key .
|
||||||
|
|
Loading…
Add table
Reference in a new issue