Example command line app that runs FlyingFox http server on port 80
% swift run flyingfox
Supply a port number:
% swift run flyingfox --port 8008
Listen on a UNIX-domain socket:
% swift run flyingfox --path fox
FlyingFox also supports Linux. Docker containers are one of the easiest methods to test linux builds from macOS.
-
Install Docker Desktop for mac
-
Checkout FlyingFoxCLI
% git checkout https://github.com/swhitty/FlyingFoxCLI
% cd FlyingFox
- Pull latest docker swift image
% docker pull swift
- Build and run FlyingFoxCLI in a swift container, listening on port 80 within the container, but published on port 8080 outside of the container.
% docker run -it \
--publish 8080:80 \
--rm \
--mount src="$(pwd)",target=/flyingfoxcli,type=bind \
swift \
/usr/bin/swift run --package-path /flyingfoxcli flyingfox --port 80
FlyingFox can be deployed and run on Google Cloud Run. Note: this requires a Google Cloud project {project}
setup with billing enabled.
Use homebrew to install the google cloud SDK
% brew install --cask google-cloud-sdk
Build on Google Cloud:
% gcloud builds submit --tag gcr.io/{project}/flyingfox --project={project}
Deploy docker image that was built and now exists within container registry:
% gcloud run deploy flyingfox --image gcr.io/{project}/flyingfox --platform managed --allow-unauthenticated --project={project}
Build locally using docker (faster) Requires Docker desktop
% docker build . -t gcr.io/{project}/flyingfox
Configure docker to use google auth (one-time-only)
% gcloud auth configure-docker
Push locally built image to google cloud container registry.
% docker image push gcr.io/{project}/flyingfox
Deploy docker image that was built and now exists within container registry
% gcloud run deploy flyingfox --image gcr.io/{project}/flyingfox --platform managed --allow-unauthenticated --project={project}