Last active
April 20, 2023 23:21
-
-
Save onpaws/ffed3040f8b0c4db435e19ceb4a59a8f to your computer and use it in GitHub Desktop.
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
# syntax=docker/dockerfile:1 | |
### Seafowl https://github.com/splitgraph/seafowl/blob/main/Dockerfile | |
# Assumes Seafowl binary is already present | |
# Download from https://github.com/splitgraph/seafowl/releases | |
FROM debian:bullseye-slim | |
COPY ./seafowl /usr/local/bin/seafowl | |
# Make sure to install ca-certificates so that we can use HTTPS | |
# https://github.com/debuerreotype/docker-debian-artifacts/issues/15 | |
RUN \ | |
apt-get update -qq && \ | |
apt-get install -y --no-install-recommends ca-certificates curl gnupg && \ | |
update-ca-certificates && \ | |
mkdir -p /seafowl-data && \ | |
mkdir -p /etc/seafowl | |
# TODO: probably OK to remove this since we're on object_store anyway | |
# Make /seafowl-data a volume | |
# This is not required for bind mounting, but will create an anonymous volume | |
# on startup for persistence | |
# https://docs.docker.com/engine/reference/builder/#volume | |
VOLUME [ "/seafowl-data" ] | |
### gcsfuse https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/run/filesystem/Dockerfile | |
# Install system dependencies | |
RUN set -e; \ | |
apt-get install -y \ | |
tini \ | |
lsb-release; \ | |
gcsFuseRepo=gcsfuse-`lsb_release -c -s`; \ | |
echo "deb http://packages.cloud.google.com/apt $gcsFuseRepo main" | \ | |
tee /etc/apt/sources.list.d/gcsfuse.list; \ | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ | |
apt-key add -; \ | |
apt-get update; \ | |
apt-get install -y gcsfuse \ | |
&& apt-get clean | |
# Set fallback mount directory | |
ENV MNT_DIR /mnt/gcs | |
# Copy local code to the container image. | |
ENV APP_HOME /app | |
WORKDIR $APP_HOME | |
COPY . ./ | |
# Ensure the script is executable | |
RUN chmod +x /app/gcsfuse_run.sh | |
# Use tini to manage zombie processes and signal forwarding | |
# https://github.com/krallin/tini | |
ENTRYPOINT ["/usr/bin/tini", "--"] | |
# Pass the startup script as arguments to Tini | |
CMD ["/app/gcsfuse_run.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
#!/usr/bin/env bash | |
set -eo pipefail | |
# Create mount directory for service | |
mkdir -p $MNT_DIR | |
echo "Mounting GCS Fuse." | |
gcsfuse --debug_gcs --debug_fuse $BUCKET $MNT_DIR | |
echo "Mounting completed." | |
# Cloud Run suggests we honor $PORT, wire it in as an env var | |
exec env SEAFOWL__FRONTEND__HTTP_BIND_PORT=$PORT seafowl -c /etc/seafowl/seafowl.toml & | |
# Exit immediately when one of the background processes terminate. | |
wait -n | |
# [END cloudrun_fuse_script] | |
# See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/run/filesystem/gcsfuse_run.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment