You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
# syntax=docker/dockerfile:1
|
|
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 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
|
|
ARG OLLAMA_HOST
|
|
ARG OLLAMA_PORT
|
|
ARG SINCE
|
|
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
|
|
# Prepare known_hosts and try to pre-fetch host key (non-fatal if unreachable at build time)
|
|
RUN touch /root/.ssh/known_hosts && chmod 600 /root/.ssh/known_hosts
|
|
RUN ssh-keyscan -T 5 -H "$OLLAMA_HOST" >> /root/.ssh/known_hosts || true
|
|
|
|
# Copy script
|
|
WORKDIR /app
|
|
COPY scripts/* .
|
|
|
|
#COPY scripts/auto-boot-ollama-host.sh /usr/local/bin/auto-boot-ollama-host.sh
|
|
#RUN chmod +x /usr/local/bin/auto-boot-ollama-host.sh
|
|
|
|
# Environment defaults (can be overridden by compose/Komodo)
|
|
ENV CONTAINER_NAME=paperless-ai \
|
|
OLLAMA_HOST=${OLLAMA_HOST} \
|
|
OLLAMA_PORT=${OLLAMA_PORT} \
|
|
SINCE=${SINCE:-0s}
|
|
|
|
ENTRYPOINT ["lua5.4", "/app/auto-boot-ollama-host.lua"]
|