Skip to content

lucasvmigotto/dilemanator

Repository files navigation

dilemanator

Inspired by "After Dinner Amusements: Which Would You Choose?: 50 Amusing Dilemmas".

Pre-requisites

Development

Setup environment

  1. Clone the repository

    • SSH:

      git clone [email protected]:lucasvmigotto/dilemanator.git
    • HTTPS:

      git clone https://github.com/lucasvmigotto/dilemanator.git
  2. Copy the file .env.example and rename it to .env

    In order to make the application functional, you must inform values for APP__MODEL_APIKEY and APP__DILEMAS_SAMPLES_URL

    Customize, if needed, the additional inner values

Application start

  • Run the following command:

    streamlit run src/main.py \
        --server.headless True \
        --browser.gatherUsageStats False \
        --server.address "$APP__HOST" \
        --server.port "$APP__PORT" # --server.runOnSave True

    Uncomment --server.runOnSave True to enable hot reload

Deployment

Build Docker Image

  • Run the following command to build the image
GCP_PROJECT_ID='<GCloud Project Id>'
GCP_REPOSITORY_NAME='<Artifact repository name>'
IMAGE_NAME='dilemanator'
CONTAINER_REPOSITORY="us-central1-docker.pkg.dev/${GCP_PROJECT_ID}/${GCP_REPOSITORY_NAME}"
TAG="$(git describe --tags --abbrev=0)"
CONTAINER_PUSH_NAME="${CONTAINER_REPOSITORY}/${IMAGE_NAME}:${TAG}"

docker build \
    --tag "${CONTAINER_PUSH_NAME}" \
    -f Dockerfile \
    --progress plain \
    --no-cache \
    .

Running a test container

  • Create a container to test the builded image:

    docker run \
        --rm \
        --name "test_container" \
        --publish 8080:8080 \
        --env APP__DILEMAS_SAMPLES_URL="<Dilemas samples URL>" \
        --env APP__MODEL_APIKEY="<Gemini API Key>" \
        "${CONTAINER_PUSH_NAME}"

Deploy

Google Cloud Platform (Cloud Run)

TODO

References

About

Create DIlemas

Resources

Stars

Watchers

Forks

Packages

No packages published