Skip to content

Commit

Permalink
fly deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterjx9 committed May 18, 2023
1 parent 707a632 commit 3f4fc66
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 19 deletions.
54 changes: 37 additions & 17 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
name: Push Container to Heroku

on:

name: Fly Deploy
on:
push:
branches:
- main

jobs:
build:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Login to Heroku Container registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Build and push
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:push -a ${{ secrets.HEROKU_APP_NAME }} web
- name: Release
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release -a ${{ secrets.HEROKU_APP_NAME }} web
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}


# OLD PROCESS WHEN HEROKU WAS FREE. ALSO SOME RANDOM OLD THAT CAN BE DELETED.
# name: Push Container to Heroku

# on:
# push:
# branches:
# - main

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - name: Login to Heroku Container registry
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:login
# - name: Build and push
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:push -a ${{ secrets.HEROKU_APP_NAME }} web
# - name: Release
# env:
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
# run: heroku container:release -a ${{ secrets.HEROKU_APP_NAME }} web

# name: Docker Image CI

Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ RUN printenv
CMD ["python", "app.py"]
# SHELL ["/bin/bash", "-c"]

# export DOCKER_DEFAULT_PLATFORM=linux/amd64
# export DOCKER_DEFAULT_PLATFORM=linux/amd64

# some code that could be useful for running docker with volume locally for testing
# docker run -p 5000:5000 -v C:\Users\RKerrigan\Scripts\pirate:/app --name mysockettest -t sockettest
7 changes: 6 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def hello():

@app.route('/grvgm', methods=['GET'])
def grvgm():
# 1. Grab music from database by random. Grab the first instance
musicdata = music.query.order_by(func.random()).first()
# 2. grab music images by the specific music that was first grabbed from the first query
# Note: If there isn't any image for the music, use the generic music icon
musicimgdata = musicimages.query.filter_by(gamealbum = musicdata.gamealbum).order_by(func.random()).first()
if musicimgdata == None:
musicimgdata = "https://media.idownloadblog.com/wp-content/uploads/2018/03/Apple-Music-icon-003.jpg"
Expand All @@ -124,6 +127,7 @@ def grvgm():
print(musicimgdata.gameart)
musicimgdata = musicimgdata.gameart

# Create music information object to be sent to the front end
musicobject = [{
"name": musicdata.gametrackname,
"path": musicdata.gamelink,
Expand All @@ -144,6 +148,7 @@ def vgmplayer():


if __name__ == "__main__":
app.run(host="0.0.0.0", port=os.environ["PORT"], threaded=True)
app.run(host="0.0.0.0", threaded=True)
# app.run(host="0.0.0.0", port=os.environ["PORT"], threaded=True)
# app.run()

0 comments on commit 3f4fc66

Please sign in to comment.