Closed sweetcard closed 6 months ago
@sweetcard - that is a great idea - maybe we should label it with -slim
or something. What distribution of Linux are the folks using these days, is it Debian, rocky, or something else?
Would you still want the starting sample database files, and/or TLS setup files in the image?
Alpine will be a wonderful base linux image. It's small enough for production. I think sample database files and other setup files are unnecessary for production. They can be found in the current image. Thank you again.đź‘Ť
Could you try this to see if it meets your needs? I had trouble getting alpine to work (due to missing C++ libraries, etc..):
FROM ubuntu:24.04
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
RUN printf "I'm building for TARGETPLATFORM=${TARGETPLATFORM}" \
&& printf ", TARGETARCH=${TARGETARCH}" \
&& printf ", TARGETVARIANT=${TARGETVARIANT} \n" \
&& printf "With uname -s : " && uname -s \
&& printf "and uname -m : " && uname -m
RUN apt-get update && \
apt-get dist-upgrade --yes && \
apt-get install -y \
curl \
zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create an application user
RUN useradd app_user --create-home
ARG APP_DIR=/opt/flight_sql
RUN mkdir --parents ${APP_DIR} && \
chown app_user:app_user ${APP_DIR} && \
chown --recursive app_user:app_user /usr/local
# Switch to a less privileged user...
USER app_user
WORKDIR ${APP_DIR}
# Copy the scripts directory into the image (we copy directory-by-directory in order to maximize Docker caching)
COPY --chown=app_user:app_user scripts scripts
RUN case ${TARGETPLATFORM} in \
"linux/amd64") FLIGHT_SQL_FILE=https://github.com/voltrondata/flight-sql-server-example/releases/latest/download/flight_sql_cli_linux_amd64.zip ;; \
"linux/arm64") FLIGHT_SQL_FILE=https://github.com/voltrondata/flight-sql-server-example/releases/latest/download/flight_sql_cli_linux_arm64.zip ;; \
esac && \
curl --output /tmp/flight_sql.zip --location ${FLIGHT_SQL_FILE} && \
unzip /tmp/flight_sql.zip -d /usr/local/bin && \
rm /tmp/flight_sql.zip
EXPOSE 31337
ENTRYPOINT scripts/start_flight_sql_slim.sh
This built an image that is about: 270MB for me...
If that is ok, I'll add this to the CI for building a slim image.
That’s amazing! I’m waiting for the slim image👍
hey @sweetcard - I merged a PR that introduced the -slim
images. Thanks for the idea!
hey @sweetcard - I merged a PR that introduced the
-slim
images. Thanks for the idea!
đź‘ŤThank you very much!
Thank you for your excellent work. The voltrondata/flight-sql:latest image exceeds 2GB, which is too large for deployment with just DuckDB/SQLite. Could you create a lighter version of the image that excludes Python and any other unnecessary files?