Llama / Dockerfile
Modanmohammad's picture
Update Dockerfile
6864fef verified
Raw
History Blame Contribute Delete
1.8 kB
# syntax=docker/dockerfile:1
ARG DEBIAN_VERSION=bullseye
################################################################################
# Use debian image as downloader image for final stage.
# https://hub.docker.com/_/debian
################################################################################
FROM debian:${DEBIAN_VERSION}-slim AS downloader
# Set working directory.
WORKDIR /download
# Install curl.
RUN apt-get update && apt-get install -y curl
# Download latest llamafile from github.
RUN curl -L -o ./llamafile https://github.com/Mozilla-Ocho/llamafile/releases/download/0.8.9/llamafile-0.8.9
# Make llamafile executable.
RUN chmod +x ./llamafile
# Download the Code-Llama-3-8B-Q8_0 model
RUN curl -L -o ./Code-Llama-3-8B-Q8_0.gguf https://huggingface.co/bartowski/Code-Llama-3-8B-GGUF/resolve/main/Code-Llama-3-8B-Q8_0.gguf
################################################################################
# Use debian image as final image.
# https://hub.docker.com/_/debian
################################################################################
FROM debian:${DEBIAN_VERSION}-slim AS final
# Create user to run llamafile as non-root.
RUN addgroup --gid 1000 user
RUN adduser --uid 1000 --gid 1000 --disabled-password --gecos "" user
# Switch to user.
USER user
# Set working directory.
WORKDIR /usr/src/app
# Copy llamafile and model from downloader image.
COPY --from=downloader /download/llamafile ./llamafile
COPY --from=downloader /download/Code-Llama-3-8B-Q8_0.gguf ./Code-Llama-3-8B-Q8_0.gguf
# Expose 8080 port.
EXPOSE 7860
# Set entrypoint.
ENTRYPOINT ["/bin/sh", "/usr/src/app/llamafile"]
# Set default command to run the server with the downloaded model.
CMD ["--server", "--host", "0.0.0.0", "--port", "7860", "-m", "./Code-Llama-3-8B-Q8_0.gguf"]