-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Dockerfile to Ubuntu 22.04 + integrate qlever script #1439
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,51 +1,47 @@ | ||||||||
FROM ubuntu:22.04 as base | ||||||||
FROM ubuntu:24.04 AS base | ||||||||
LABEL maintainer="Johannes Kalmbach <[email protected]>" | ||||||||
ENV LANG C.UTF-8 | ||||||||
ENV LC_ALL C.UTF-8 | ||||||||
ENV LC_CTYPE C.UTF-8 | ||||||||
ENV LANG=C.UTF-8 | ||||||||
ENV LC_ALL=C.UTF-8 | ||||||||
ENV LC_CTYPE=C.UTF-8 | ||||||||
ENV DEBIAN_FRONTEND=noninteractive | ||||||||
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:mhier/libboost-latest | ||||||||
|
||||||||
FROM base as builder | ||||||||
RUN apt-get update && apt-get install -y build-essential cmake libicu-dev tzdata pkg-config uuid-runtime uuid-dev git libjemalloc-dev ninja-build libzstd-dev libssl-dev libboost1.81-dev libboost-program-options1.81-dev libboost-iostreams1.81-dev libboost-url1.81-dev | ||||||||
FROM base AS builder | ||||||||
RUN apt-get update && apt-get install -y build-essential cmake libicu-dev tzdata pkg-config uuid-runtime uuid-dev git libjemalloc-dev ninja-build libzstd-dev libssl-dev libboost1.83-dev libboost-program-options1.83-dev libboost-iostreams1.83-dev libboost-url1.83-dev | ||||||||
|
||||||||
COPY . /app/ | ||||||||
COPY . /qlever/ | ||||||||
|
||||||||
WORKDIR /app/ | ||||||||
WORKDIR /qlever/ | ||||||||
ENV DEBIAN_FRONTEND=noninteractive | ||||||||
|
||||||||
WORKDIR /app/build/ | ||||||||
WORKDIR /qlever/build/ | ||||||||
RUN cmake -DCMAKE_BUILD_TYPE=Release -DLOGLEVEL=INFO -DUSE_PARALLEL=true -D_NO_TIMING_TESTS=ON -GNinja .. && ninja | ||||||||
RUN ctest --rerun-failed --output-on-failure | ||||||||
|
||||||||
FROM base as runtime | ||||||||
WORKDIR /app | ||||||||
FROM base AS runtime | ||||||||
WORKDIR /qlever | ||||||||
ENV DEBIAN_FRONTEND=noninteractive | ||||||||
RUN apt-get update && apt-get install -y wget python3-yaml unzip curl bzip2 pkg-config libicu-dev python3-icu libgomp1 uuid-runtime make lbzip2 libjemalloc-dev libzstd-dev libssl-dev libboost1.81-dev libboost-program-options1.81-dev libboost-iostreams1.81-dev libboost-url1.81-dev | ||||||||
RUN apt-get update && apt-get install -y wget python3-yaml unzip curl bzip2 pkg-config libicu-dev python3-icu libgomp1 uuid-runtime make lbzip2 libjemalloc-dev libzstd-dev libssl-dev libboost1.83-dev libboost-program-options1.83-dev libboost-iostreams1.83-dev libboost-url1.83-dev pipx bash-completion | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove
Suggested change
|
||||||||
ARG UID=1000 | ||||||||
RUN groupadd -r qlever && useradd --no-log-init -r -u $UID -g qlever qlever && chown qlever:qlever /app | ||||||||
ARG UID=2000 | ||||||||
RUN groupadd -r qlever && useradd --no-log-init -d /qlever -r -u $UID -g qlever qlever && chown qlever:qlever /qlever | ||||||||
USER qlever | ||||||||
ENV PATH=/app/:$PATH | ||||||||
RUN PIPX_HOME=/qlever/.local PIPX_BIN_DIR=/qlever/.local/bin PIPX_MAN_DIR=/qlever/.local/share pipx install qlever | ||||||||
RUN echo "eval \"\$(register-python-argcomplete qlever)\"" >> /qlever/.bashrc | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something that might be good to do is to lock a specific version of the First define an
Then you might need to tell the layer to use the
in the layer. And then, you can use it that way, if I'm not mistaking on how to specify a package version with pipx (I guess it should behave like pip):
Suggested change
You can take a look here for an example: https://github.com/zazukoians/qlever-tests/blob/76ada0b53174beb79d11ed14662536689a165fff/docker/server.Dockerfile |
||||||||
ENV QLEVER_ARGCOMPLETE_ENABLED=1 | ||||||||
|
||||||||
COPY --from=builder /app/build/*Main /app/ | ||||||||
COPY --from=builder /app/e2e/* /app/e2e/ | ||||||||
ENV PATH=/app/:$PATH | ||||||||
COPY --from=builder /qlever/build/*Main /qlever/ | ||||||||
COPY --from=builder /qlever/e2e/* /qlever/e2e/ | ||||||||
ENV PATH=/qlever/:/qlever/.local/bin:$PATH | ||||||||
|
||||||||
USER qlever | ||||||||
EXPOSE 7001 | ||||||||
VOLUME ["/input", "/index"] | ||||||||
VOLUME ["/data"] | ||||||||
|
||||||||
ENV INDEX_PREFIX index | ||||||||
ENV MEMORY_FOR_QUERIES 70 | ||||||||
ENV CACHE_MAX_SIZE_GB 30 | ||||||||
ENV CACHE_MAX_SIZE_GB_SINGLE_ENTRY 5 | ||||||||
ENV CACHE_MAX_NUM_ENTRIES 1000 | ||||||||
# Need the shell to get the INDEX_PREFIX environment variable | ||||||||
ENTRYPOINT ["/bin/sh", "-c", "exec ServerMain -i \"/index/${INDEX_PREFIX}\" -j 8 -m ${MEMORY_FOR_QUERIES} -c ${CACHE_MAX_SIZE_GB} -e ${CACHE_MAX_SIZE_GB_SINGLE_ENTRY} -k ${CACHE_MAX_NUM_ENTRIES} -p 7001 \"$@\"", "--"] | ||||||||
ENTRYPOINT ["bash"] | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest using the default entrypoint from the Ubuntu Docker image (preferred):
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or explicitly set it to an empty one:
Suggested change
|
||||||||
# Build image: docker build -t qlever.master . | ||||||||
# Build image: docker build -t qlever . | ||||||||
|
||||||||
# Build index: DB=wikidata; docker run -it --rm -v "$(pwd)":/index --entrypoint bash --name qlever.$DB-index qlever.master -c "IndexBuilderMain -f /index/$DB.nt -i /index/$DB -s /index/$DB.settings.json | tee /index/$DB.index-log.txt"; rm -f $DB/*tmp* | ||||||||
# Run container, interactive session: docker run -it --rm -v "$(pwd)":/data --name qlever qlever | ||||||||
|
||||||||
# Run engine: DB=wikidata; PORT=7001; docker rm -f qlever.$DB; docker run -d --restart=unless-stopped -v "$(pwd)":/index -p $PORT:7001 -e INDEX_PREFIX=$DB -e MEMORY_FOR_QUERIES=30 --name qlever.$DB qlever.master; docker logs -f --tail=100 qlever.$DB | ||||||||
# Run container, create SPARQL endpoint for "Olympics" dataset: docker run -it --rm -v "$(pwd)":/data -p 7001:7001 --name qlever qlever -c "qlever setup-config olympics && qlever get-data && qlever index --system native && qlever start --system native --port 7001 && qlever example-queries --port 7001" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM ubuntu:22.04 as base | ||
LABEL maintainer="Johannes Kalmbach <[email protected]>" | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV LC_CTYPE C.UTF-8 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:mhier/libboost-latest | ||
|
||
FROM base as builder | ||
RUN apt-get update && apt-get install -y build-essential cmake libicu-dev tzdata pkg-config uuid-runtime uuid-dev git libjemalloc-dev ninja-build libzstd-dev libssl-dev libboost1.81-dev libboost-program-options1.81-dev libboost-iostreams1.81-dev libboost-url1.81-dev | ||
|
||
COPY . /app/ | ||
|
||
WORKDIR /app/ | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
WORKDIR /app/build/ | ||
RUN cmake -DCMAKE_BUILD_TYPE=Release -DLOGLEVEL=INFO -DUSE_PARALLEL=true -D_NO_TIMING_TESTS=ON -GNinja .. && ninja | ||
RUN ctest --rerun-failed --output-on-failure | ||
|
||
FROM base as runtime | ||
WORKDIR /app | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y wget python3-yaml unzip curl bzip2 pkg-config libicu-dev python3-icu libgomp1 uuid-runtime make lbzip2 libjemalloc-dev libzstd-dev libssl-dev libboost1.81-dev libboost-program-options1.81-dev libboost-iostreams1.81-dev libboost-url1.81-dev | ||
|
||
ARG UID=1000 | ||
RUN groupadd -r qlever && useradd --no-log-init -r -u $UID -g qlever qlever && chown qlever:qlever /app | ||
USER qlever | ||
ENV PATH=/app/:$PATH | ||
|
||
COPY --from=builder /app/build/*Main /app/ | ||
COPY --from=builder /app/e2e/* /app/e2e/ | ||
ENV PATH=/app/:$PATH | ||
|
||
USER qlever | ||
EXPOSE 7001 | ||
VOLUME ["/input", "/index"] | ||
|
||
ENV INDEX_PREFIX index | ||
ENV MEMORY_FOR_QUERIES 70 | ||
ENV CACHE_MAX_SIZE_GB 30 | ||
ENV CACHE_MAX_SIZE_GB_SINGLE_ENTRY 5 | ||
ENV CACHE_MAX_NUM_ENTRIES 1000 | ||
# Need the shell to get the INDEX_PREFIX environment variable | ||
ENTRYPOINT ["/bin/sh", "-c", "exec ServerMain -i \"/index/${INDEX_PREFIX}\" -j 8 -m ${MEMORY_FOR_QUERIES} -c ${CACHE_MAX_SIZE_GB} -e ${CACHE_MAX_SIZE_GB_SINGLE_ENTRY} -k ${CACHE_MAX_NUM_ENTRIES} -p 7001 \"$@\"", "--"] | ||
|
||
# Build image: docker build -t qlever.master . | ||
|
||
# Build index: DB=wikidata; docker run -it --rm -v "$(pwd)":/index --entrypoint bash --name qlever.$DB-index qlever.master -c "IndexBuilderMain -f /index/$DB.nt -i /index/$DB -s /index/$DB.settings.json | tee /index/$DB.index-log.txt"; rm -f $DB/*tmp* | ||
|
||
# Run engine: DB=wikidata; PORT=7001; docker rm -f qlever.$DB; docker run -d --restart=unless-stopped -v "$(pwd)":/index -p $PORT:7001 -e INDEX_PREFIX=$DB -e MEMORY_FOR_QUERIES=30 --name qlever.$DB qlever.master; docker logs -f --tail=100 qlever.$DB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer required. The used boost packages are from the official package repositories now.