Skip to content

Commit

Permalink
Merge pull request #256 from freezingsaddles/github-actions-docker-build
Browse files Browse the repository at this point in the history
  • Loading branch information
obscurerichard authored Nov 10, 2024
2 parents c8e775f + 4e4a9d4 commit b49fa1d
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Docker Build and Push

on:
workflow_call:
inputs:
org:
default: freezingsaddles
description: 'Docker Hub organization'
required: false
type: string
repo:
default: freezing-web
description: 'Docker Hub repository name'
required: false
type: string
tag:
default: latest
description: 'tag for Docker container'
required: false
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ inputs.org }}/${{ inputs.repo }}:${{ inputs.tag }}
47 changes: 47 additions & 0 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Build Deploy and Test Latest

on:
push:
branches:
- 'master'

jobs:

docker:
uses: freezingsaddles/freezing-web/.github/workflows/[email protected]
with:
tag: latest
secrets: inherit

deploy-and-test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: install
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
passphrase: ${{ secrets.PASSPHRASE }}
script: |
set -euo pipefail
cd /opt/compose
docker-compose pull freezing-web
docker-compose up -d freezing-web
- name: wait
uses: iFaxity/[email protected]
with:
resource: https-get://freezingsaddles.org
timeout: 5000

- name: checkout
uses: actions/checkout@v4

- name: test-wget-spider
run: "URL=https://freezingsaddles.org test/wget-spider.sh"

14 changes: 14 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Build Tag

on:
push:
tags:
- '*'

jobs:
docker:
uses: freezingsaddles/freezing-web/.github/workflows/[email protected]
with:
tag: ${{ github.ref_name }}
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Build

on: pull_request

jobs:
docker:
uses: freezingsaddles/freezing-web/.github/workflows/[email protected]
with:
tag: latest-actions-build
secrets: inherit
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Lint

on: [push, pull_request]
on: pull_request

jobs:

Expand All @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: black Lint
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ WORKDIR /app
ENV LEADERBOARDS_DIR=/data/leaderboards
USER freezing
EXPOSE 8000
ENTRYPOINT gunicorn --bind 0.0.0.0:8000 'freezing.web:app'
ENTRYPOINT ["gunicorn", "--bind", "0.0.0.0:8000", "freezing.web:app"]

0 comments on commit b49fa1d

Please sign in to comment.