Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker build #256

Merged
merged 37 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
828260b
Add first cut of Docker action
obscurerichard Nov 10, 2024
ec47631
Bump versions to avoid node deprecation warnings
obscurerichard Nov 10, 2024
a1c5afb
Try to split action, prep for reusable parts
obscurerichard Nov 10, 2024
d3f5f01
Tweak workflow call
obscurerichard Nov 10, 2024
afc68ac
Fix indent level
obscurerichard Nov 10, 2024
0512919
Bump version, fix path
obscurerichard Nov 10, 2024
d985819
Tweak workflow call
obscurerichard Nov 10, 2024
6032ad6
Tweak inputs and secrets
obscurerichard Nov 10, 2024
57f5387
Pare back to pull request
obscurerichard Nov 10, 2024
836d6e3
Tweak indents and version
obscurerichard Nov 10, 2024
d5d231a
Add required type
obscurerichard Nov 10, 2024
c4377d5
Tweak version
obscurerichard Nov 10, 2024
e2ffd41
Tweak default tag to latest - ugh
obscurerichard Nov 10, 2024
fc36330
Tweak version
obscurerichard Nov 10, 2024
25b29b2
dumb down
obscurerichard Nov 10, 2024
6402d7c
Tweak version
obscurerichard Nov 10, 2024
496cb6a
Tweak syntax and version
obscurerichard Nov 10, 2024
6f56dcb
Tweak ENTRYPOINT per Docker action advice
obscurerichard Nov 10, 2024
85529c8
Build more variants
obscurerichard Nov 10, 2024
8775e83
Simplify
obscurerichard Nov 10, 2024
6a2a8fb
Add SSH action
obscurerichard Nov 10, 2024
0e8517e
Fix syntax
obscurerichard Nov 10, 2024
eebd365
Just debug ssh
obscurerichard Nov 10, 2024
66b92d9
Add runner
obscurerichard Nov 10, 2024
a2a96db
Switch to restart
obscurerichard Nov 10, 2024
21a7e1f
deploy explicitly
obscurerichard Nov 10, 2024
2be86a0
Tweak cli order
obscurerichard Nov 10, 2024
a67f644
Go all the way to testing
obscurerichard Nov 10, 2024
cd379c1
Fix syntax
obscurerichard Nov 10, 2024
07a0dea
Fix action version
obscurerichard Nov 10, 2024
c903f32
re-arm pr branch
obscurerichard Nov 10, 2024
64d047d
Bump version for release
obscurerichard Nov 10, 2024
816efca
Fix name, Bump version for release
obscurerichard Nov 10, 2024
9ad5a46
Fix indent, bump version for release
obscurerichard Nov 10, 2024
70887f8
Fix indents and versions again
obscurerichard Nov 10, 2024
58e0222
Yet more bumps and indent tweaks
obscurerichard Nov 10, 2024
4e4a9d4
Bump version for release
obscurerichard Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]