Re-added app_sdk to main repo with MIT

This commit is contained in:
frikky
2020-05-24 06:50:59 +02:00
parent bd375f3a28
commit f94ef2bffa
13 changed files with 62 additions and 8 deletions
+11 -2
View File
@@ -2,6 +2,7 @@ from golang as builder
# Add files
RUN mkdir /app
RUN mkdir /app_sdk
WORKDIR /app
ADD ./go-app/main.go /app
ADD ./go-app/walkoff.go /app
@@ -14,13 +15,21 @@ RUN go get -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o webapp .
# Certificate build
# Certificate build - gets required certs
FROM alpine:latest as certs
RUN apk --update add ca-certificates
from scratch
COPY --from=builder /app/ /
RUN mkdir /app
RUN mkdir /app_sdk
# Required files for code generation
ADD ./app_sdk/app_sdk.py /app_sdk
ADD ./app_sdk/static_baseline.py /app_sdk
COPY --from=builder /app/ /app
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
WORKDIR /app
EXPOSE 5001
CMD ["./webapp"]
+16
View File
@@ -0,0 +1,16 @@
FROM python:3.7-alpine as base
FROM base as builder
RUN apk --no-cache add --update alpine-sdk libffi libffi-dev musl-dev openssl-dev
RUN mkdir /install
WORKDIR /install
COPY requirements.txt /requirements.txt
RUN pip install --prefix="/install" -r /requirements.txt
FROM base
COPY --from=builder /install /usr/local
COPY __init__.py /app/walkoff_app_sdk/__init__.py
COPY app_base.py /app/walkoff_app_sdk/app_base.py
+16
View File
@@ -0,0 +1,16 @@
# app_sdk.py
This is the SDK used for apps to behave like they should.
To change it in the backend, upload it to Buckets/shuffler.appspot.com/generated_apps/baseline.
# static_baseline.py
It's used for python code generation and should be under MIT. Has to be located here because it's used by the backend.
## 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?)
# LICENSE
Everything in here is MIT, not AGPLv3 as indicated by the license.
View File
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
docker rmi frikky/shuffle:app_sdk
docker build . -t frikky/shuffle:app_sdk --no-cache
docker push frikky/shuffle:app_sdk
+8
View File
@@ -0,0 +1,8 @@
# App_sdk
App_sdk development is continued here: https://github.com/frikky/Shuffle-apps/tree/master/app_sdk
# Added static:baseline.py
It's used for python code generation and should be under MIT.
# LICENSE
Everything in this folder is MIT, not AGPLv3
+2
View File
@@ -0,0 +1,2 @@
requests
urllib3
+2 -2
View File
@@ -122,8 +122,8 @@ func streamZipdata(ctx context.Context, identifier, pythoncode, requirements str
func getAppbase() ([]byte, []byte, error) {
// 1. Have baseline in bucket/generated_apps/baseline
// 2. Copy the baseline to a new folder with identifier name
static := "../../functions/static_baseline.py"
appbase := "../../functions/onprem/app_sdk/app_base.py"
static := "../app_sdk/static_baseline.py"
appbase := "../app_sdk/app_base.py"
staticData, err := ioutil.ReadFile(static)
if err != nil {
+3
View File
@@ -17,3 +17,6 @@ The point of this folder is to make GCP Cloud functions able to run default WALK
* class AppBase
* class <APP>
* Runner
## Update may 2020:
Moved static_baseline to ./onprem/app_sdk because of license.
-4
View File
@@ -1,4 +0,0 @@
# App_sdk
App_sdk development is continued here: https://github.com/frikky/Shuffle-apps/tree/master/app_sdk
It's under MIT license, NOT AGPLv3.