Skip to content

Latest commit

 

History

History
100 lines (71 loc) · 2.83 KB

README.md

File metadata and controls

100 lines (71 loc) · 2.83 KB

Platforms Swift 5.5 License Twitter

FlyingFoxCLI

Example command line app that runs FlyingFox http server on port 80

Run

% swift run flyingfox

Supply a port number:

% swift run flyingfox --port 8008

Listen on a UNIX-domain socket:

% swift run flyingfox --path fox

Run Locally with Docker

FlyingFox also supports Linux. Docker containers are one of the easiest methods to test linux builds from macOS.

  1. Install Docker Desktop for mac

  2. Checkout FlyingFoxCLI

% git checkout https://github.com/swhitty/FlyingFoxCLI
% cd FlyingFox
  1. Pull latest docker swift image
% docker pull swift
  1. 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

Google Cloud Run

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

Cloud Build & Deploy

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}

Local Build & Deploy

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}