-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding slim docker image. Closes #36 * Bugfix for slim start script * Misc. fixes for slim
- Loading branch information
Showing
4 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 | ||
|
||
COPY --chown=app_user:app_user flight_sql_server /usr/local/bin/flight_sql_server | ||
RUN chmod +x /usr/local/bin/flight_sql_server | ||
|
||
COPY --chown=app_user:app_user flight_sql_client /usr/local/bin/flight_sql_client | ||
RUN chmod +x /usr/local/bin/flight_sql_client | ||
|
||
EXPOSE 31337 | ||
|
||
ENTRYPOINT scripts/start_flight_sql_slim.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
L_DATABASE_FILENAME=${1:-${DATABASE_FILENAME?"You must specify a database filename."}} | ||
L_DATABASE_BACKEND=${2:-${DATABASE_BACKEND:-"duckdb"}} | ||
L_PRINT_QUERIES=${3:-${PRINT_QUERIES:-"1"}} | ||
L_TLS_ENABLED=${4:-${TLS_ENABLED:-"0"}} | ||
L_TLS_CERT=${5:-${TLS_CERT}} | ||
L_TLS_KEY=${6:-${TLS_KEY}} | ||
|
||
TLS_ARG="" | ||
if [ "${L_TLS_ENABLED}" == "1" ] | ||
then | ||
# Make sure L_TLS_CERT and L_TLS_KEY were provided | ||
if [ -z "${L_TLS_CERT}" ] || [ -z "${L_TLS_KEY}" ] | ||
then | ||
echo "TLS_CERT and TLS_KEY must be passed when TLS is enabled." | ||
exit 1 | ||
fi | ||
|
||
TLS_ARG="--tls ${L_TLS_CERT} ${L_TLS_KEY}" | ||
fi | ||
|
||
# Setup the print_queries option | ||
PRINT_QUERIES_FLAG="" | ||
if [ "${L_PRINT_QUERIES}" == "1" ] | ||
then | ||
PRINT_QUERIES_FLAG="--print-queries" | ||
fi | ||
|
||
flight_sql_server --backend="${L_DATABASE_BACKEND}" --database-filename="${L_DATABASE_FILENAME}" ${TLS_ARG} ${PRINT_QUERIES_FLAG} |