Skip to content

Commit

Permalink
Edit README and add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Rooyca committed Jul 14, 2023
1 parent 0634f3c commit a350d3e
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Create and publish a Docker image

on:
push:
branches: ['master']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ronald Cantillo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 71 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,77 @@
Web app similar to LinkTree using information from GitHub profile.
> From [simplesite template](https://github.com/tataraba/simplesite)
![ShowCase](showcase.png)

## 🧪 Try it out

- [https://ghtree.fly.dev/](https://ghtree.fly.dev/)
> It may take a few seconds to load the first time.
### [https://ghtree.fly.dev/](https://ghtree.fly.dev/)

## 🚀 Deploy

You can run your own instance locally or deploy it to a serverless platform like [Fly.io](https://fly.io/).

### -> Locally

There are two ways to run the app locally, using Docker or Python.

#### 🐳 Docker (recommended)

```sh
docker run --rm -p 8000:8000 ghcr.io/rooyca/ghtree:latest
```

You could also build the image yourself.

```sh
docker build -t ghtree .
docker run --rm -p 8000:8000 ghtree
```

There are three Dockerfiles, one with full `python` image, one with `python:slim` and one with `python:alpine`. You can use the one that suits you best. For example, if you want to use the `slim` version, you can do:

```sh
docker build -t ghtree -f Dockerfile.slim .
docker run --rm -p 8000:8000 ghtree
```

Although I recommend using the [alpine version](Dockerfile), since it is the smallest one. Let's look at the size of each image.

| Dockerfile | Size |
| --- | --- |
| [Dockerfile (alpine)](Dockerfile) | 163 MB |
| [Dockerfile.slim](Dockerfile.slim) | 562 MB |
| [Dockerfile.full](Dockerfile.full) | +1 GB |


#### 🐍 Python

```sh
pip install -r requirements.txt
python -m uvicorn app.main:app --reload
```

### -> Serverless

You can deploy the app to any serverless platform that supports Python apps, like [Fly](https://fly.io/) or any other.

#### 🦋 Fly.io

```sh
fly launch
fly deploy
```

## 🛠️ Build with

- [FastAPI](https://fastapi.tiangolo.com/)
- [TailwindCSS](https://tailwindcss.com/)
- [HTMX](https://htmx.org/)
- [GitHub API](https://docs.github.com/en/rest)
- [Font Awesome](https://fontawesome.com/)

## 📄 License

## 🚧 README under construction 🚧
[MIT](LICENSE)
Binary file added showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a350d3e

Please sign in to comment.