Skip to content

Commit

Permalink
Replace fly deployment with docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Apr 24, 2024
1 parent 2ab3d00 commit 2c3a2be
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 62 deletions.
55 changes: 29 additions & 26 deletions .github/fly.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
# fly.toml file generated for marda-registry on 2023-01-08T19:25:07Z
# fly.toml app configuration file generated for datatractor-yard on 2024-04-23T21:21:20+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "marda-registry"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
app = 'datatractor-yard'
primary_region = 'lhr'
kill_signal = 'SIGINT'
kill_timeout = '5s'

[experimental]
auto_rollback = true

[build]
builder = "paketobuildpacks/builder:base"
builder = 'paketobuildpacks/builder:base'

[env]
PORT = "8080"

[experimental]
allowed_public_ports = []
auto_rollback = true
PORT = '8080'

[[services]]
http_checks = []
protocol = 'tcp'
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
processes = ['app']

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
handlers = ['http']
force_https = true

[[services.ports]]
handlers = ["tls", "http"]
port = 443
handlers = ['tls', 'http']

[services.concurrency]
type = 'connections'
hard_limit = 25
soft_limit = 20

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
interval = '15s'
timeout = '2s'
grace_period = '1s'

[[vm]]
size = 'shared-cpu-1x'
66 changes: 30 additions & 36 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
---
name: Deploy to Fly
name: Publish Docker image on release

on:
push:
branches:
- main
release:
types: [published]

jobs:
deploy-fly:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: openmsi/datatractor-yard

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

runs-on: ubuntu-latest
if: github.repository_owner == 'datatractor'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: pip install -r requirements.txt

- name: Generate Python models
run: invoke regenerate-models

- name: Set up Fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy to Fly
run: flyctl deploy --remote-only -c ./.github/fly.toml

0 comments on commit 2c3a2be

Please sign in to comment.