Add OpenSSH client installation and SSH key handling in Dockerfile
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -4,7 +4,21 @@ FROM alpine:3.20
|
||||
# Install minimal tooling
|
||||
RUN apk add --no-cache \
|
||||
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing wol \
|
||||
&& apk add --no-cache bash curl ca-certificates docker-cli lua5.4 lua5.4-socket
|
||||
&& apk add --no-cache bash curl ca-certificates docker-cli lua5.4 lua5.4-socket openssh-client
|
||||
|
||||
# Create the ssh directory
|
||||
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
|
||||
|
||||
# ssh-add ssh key from env var but do not keep env var around
|
||||
ARG SSH_PRIVATE_KEY
|
||||
ARG SSH_PUBLIC_KEY
|
||||
RUN echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa && \
|
||||
echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub && \
|
||||
chmod 600 /root/.ssh/id_rsa && \
|
||||
chmod 644 /root/.ssh/id_rsa.pub && \
|
||||
unset SSH_PRIVATE_KEY && unset SSH_PUBLIC_KEY
|
||||
RUN ssh-keyscan -H $OLLAMA_HOST >> /root/.ssh/known_hosts
|
||||
RUN chmod 600 /root/.ssh/known_hosts
|
||||
|
||||
# Copy script
|
||||
WORKDIR /app
|
||||
|
||||
Reference in New Issue
Block a user