Spaces:
Sleeping
Sleeping
FROM ubuntu:24.04 | |
ENV TZ=UTC | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
RUN apt update && apt install -y build-essential g++ cmake wget lsb-release git curl libgoogle-perftools-dev libvips-dev | |
RUN wget -O - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/openresty.gpg | |
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list | |
RUN apt update && apt install -y openresty | |
WORKDIR /opt | |
RUN git clone --branch main https://github.com/ufownl/lua-cgemma.git | |
RUN git clone https://github.com/libvips/lua-vips.git | |
RUN ln -s /opt/lua-vips/src/* /usr/local/openresty/lualib/ | |
WORKDIR /opt/lua-cgemma/build | |
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && make && make install && make clean | |
RUN resty -e 'require("cgemma").info()' | |
WORKDIR /opt/poetry-camera | |
COPY . /opt/poetry-camera/ | |
RUN --mount=type=secret,id=KAGGLE_USERNAME,mode=0444,required=true \ | |
--mount=type=secret,id=KAGGLE_KEY,mode=0444,required=true \ | |
curl -L -u $(cat /run/secrets/KAGGLE_USERNAME):$(cat /run/secrets/KAGGLE_KEY) -o - https://www.kaggle.com/api/v1/models/google/gemma-3/gemmaCpp/3.0-4b-it-sfp/1/download | tar xz | |
RUN mkdir -p /opt/poetry-camera/logs | |
RUN chmod -R 777 /opt/poetry-camera | |
CMD ["openresty", "-p", ".", "-c", "poetry-camera-hf.conf"] | |