Skip to content

Commit

Permalink
Merge pull request #3 from datlt4/feature/login
Browse files Browse the repository at this point in the history
BUG UPDATE: add authentication
  • Loading branch information
datlt4 authored Mar 19, 2024
2 parents 41afb2b + ab76ad1 commit d1f6b35
Show file tree
Hide file tree
Showing 29 changed files with 2,009 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitea/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ci

on:
on:
push:
branches:
- "main"
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/build-PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
pull_request:
branches:
- main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Build:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
# - linux/arm/v7
steps:
-
name: Checkout
uses: actions/checkout@v4 # Checkout the repository code
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3 # (Optional) Setup QEMU if needed
with:
platforms: ${{ matrix.platform }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # (Optional) Setup Docker Buildx if needed
with:
driver-opts: network=host
-
name: Login to Dockerhub # https://docs.docker.com/build/ci/github-actions/push-multi-registries/
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.ZXZ_DOCKERHUB_PAT }}
-
name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "repository_name=$(basename `git rev-parse --show-toplevel`)" >> "$GITHUB_ENV"
echo "platform=$(echo ${{ matrix.platform }} | tr -d '/' | tr -d 'linux')" >> "$GITHUB_ENV"
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: . # Docker context (path to Dockerfile and build context)
platforms: ${{ matrix.platform }}
file: ./Dockerfile # Path to Dockerfile (if not in the root)
push: false # Push the built image to a registry # ${{ github.event_name != 'pull_request' }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.repository_name }}:${{ env.sha_short }}-${{ env.platform }}
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is a no-bullshit file hosting service that also runs
Configuration
-------------

To change settings, copy ``config.py.example`` to ``instance/config.py`` and modify to your liking.
To change settings, copy ``config.py.example`` to ``instance/config.py`` and modify to your liking.
For more information on instance configuration, see `the Flask documentation <https://flask.palletsprojects.com/en/2.0.x/config/#instance-folders>`_.

To customize the home and error pages, create a ``templates`` directory
Expand Down Expand Up @@ -90,7 +90,7 @@ Optional:
reduce the bandwidth requirements for graphics.

Docker Build & Run
------------------
------------------
block::

docker build . -t 0x1a:latest
Expand Down Expand Up @@ -225,7 +225,7 @@ group.
sudo apt install -y libmagic-dev
sudo apt clean
```
- Install python dependencies
```bash
Expand All @@ -244,6 +244,14 @@ group.
# flask run -h 0.0.0.0 [-p 8003] [--debug] [--cert=adhoc]
```
- Create migration
```bash
export FLASK_APP=fhost
export FLASK_ENV=production
flask db migrate -m "Create user table"
```
## Install in docker
Expand Down
Loading

0 comments on commit d1f6b35

Please sign in to comment.