Skip to content

Commit

Permalink
Added all content and removed old dockerfiles for now
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Nov 12, 2024
1 parent 01daa0e commit 9d6e6cb
Show file tree
Hide file tree
Showing 12 changed files with 4,964 additions and 3 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/cloud_upload_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This is a basic workflow to help you get started with Actions

name: App SDK upload

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master, launch ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.SANDBOX_CREDENTIALS }}'

- id: 'upload_sdk'
name: Cloud Storage Uploader
uses: google-github-actions/[email protected]
with:
path: 'backend/app_sdk/app_base.py'
destination: 'shuffle-sandbox-337810.appspot.com/generated_apps/baseline'

- id: 'upload_requirement'
name: Cloud Storage Uploader
uses: google-github-actions/[email protected]
with:
path: 'backend/app_sdk/requirements.txt'
destination: 'shuffle-sandbox-337810.appspot.com/generated_apps/baseline'

- id: 'upload_Dockerfile'
name: Cloud Storage Uploader
uses: google-github-actions/[email protected]
with:
path: 'backend/app_sdk/Dockerfile'
destination: 'shuffle-sandbox-337810.appspot.com/generated_apps/baseline'
55 changes: 55 additions & 0 deletions .github/workflows/sdk-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Upload App SDK to PiPy

on:
workflow_dispatch: # Allows the workflow to be run manually from GitHub
inputs:
version:
description: 'Version of the package to publish'
required: true
release:
types: [published]
push:
tags:
- 'v*' # Triggers when a version tag is pushed (e.g., v1.0.0)


permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install dependencies
run: |
cd ./backend/app_sdk
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
cd ./backend/app_sdk
python -m build
- name: Move build artifacts
run: |
ls -alh
ls -alh ./backend/app_sdk
mv ./backend/app_sdk/dist ./dist
- name: Publish package
uses: pypa/[email protected]
with:
verify-metadata: false
repository-url: https://upload.pypi.org/legacy/
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
env:
ACTIONS_STEP_DEBUG: true # Enables debug mode for this step

21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#FROM python:3.9.1-alpine as base
FROM python:3.10.0-alpine as base
#FROM python:3.11.3-alpine as base

FROM base as builder
RUN apk --no-cache add --update alpine-sdk libffi libffi-dev musl-dev openssl-dev tzdata coreutils

RUN mkdir /install
WORKDIR /install

FROM base

#--no-cache
RUN apk update && apk add --update tzdata libmagic alpine-sdk libffi libffi-dev musl-dev openssl-dev coreutils

COPY --from=builder /install /usr/local
COPY requirements.txt /requirements.txt
RUN pip3 install -r /requirements.txt

COPY __init__.py /app/walkoff_app_sdk/__init__.py
COPY app_base.py /app/walkoff_app_sdk/app_base.py
2 changes: 1 addition & 1 deletion LICENSE
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Shuffle
Copyright (c) 2020 Frikkylikeme

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 22 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# app_sdk
App SDK for Shuffle. Previously in the /shuffle/shuffle/backend/app_sdk location.
# app_sdk.py
This is the SDK used for apps to behave like they should.

## If you want to update apps.. PS: downloads from docker hub do overrides.. :)
1. Write your code & check if runtime works
2. Build app_base image
3. docker rm $(docker ps -aq) # Remove all stopped containers
4. Delete the specific app's Docker image (docker rmi frikky/shuffle:...)
5. Rebuild the Docker image (click load in GUI?)

## Cloud updates
1. Go to shuffle cloud on GCP
2. Go to Cloud Storage
3. Find shuffler.appspot.com
4. Navigate to generated_apps/baseline
5. Update SDK there. This will make all new apps run with the new SDK

## Cloud app force-updates
1. Run the "stitcher.go" program in the public shuffle-shared repository.

# LICENSE
Everything in here is MIT, not AGPLv3 as indicated by the license.
Empty file added app_sdk/__init__.py
Empty file.
Loading

0 comments on commit 9d6e6cb

Please sign in to comment.