diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4efd0346c..4ac397101 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,4 +124,23 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ steps.meta-metrics.outputs.tags }} - labels: ${{ steps.meta-metrics.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta-metrics.outputs.labels }} + + # Sandbox GUI + + - name: GUI image tags & labels + id: meta-gui + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-gui + + - name: Metrics image build & push + uses: docker/build-push-action@v2 + with: + context: . + file: build/sandbox/Dockerfile + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta-gui.outputs.tags }} + labels: ${{ steps.meta-gui.outputs.labels }} \ No newline at end of file diff --git a/Makefile b/Makefile index 7c1d7c710..4590f63bf 100644 --- a/Makefile +++ b/Makefile @@ -175,3 +175,6 @@ gateway-down: gateway-clear: COMPOSE_PROJECT_NAME=bcdhub docker-compose -f docker-compose.gateway.yml down -v + +sandbox-image: + docker build -t ghcr.io/baking-bad/bcdhub-gui:master ./build/sandbox \ No newline at end of file diff --git a/build/graphql/Dockerfile b/build/graphql/Dockerfile deleted file mode 100644 index 399010fae..000000000 --- a/build/graphql/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# --------------------------------------------------------------------- -# The first stage container, for building the application -# --------------------------------------------------------------------- -FROM golang:1.15-alpine as builder - -ENV CGO_ENABLED=0 -ENV GO111MODULE=on -ENV GOOS=linux - -RUN apk --no-cache add ca-certificates -RUN apk add --update git - -RUN mkdir -p $GOPATH/src/github.com/baking-bad/bcdhub/ - -COPY ./go.* $GOPATH/src/github.com/baking-bad/bcdhub/ -WORKDIR $GOPATH/src/github.com/baking-bad/bcdhub -RUN go mod download - -COPY cmd/graphql cmd/graphql -COPY internal internal - -WORKDIR $GOPATH/src/github.com/baking-bad/bcdhub/cmd/graphql/ -RUN go build -a -installsuffix cgo -o /go/bin/graphql . - -# --------------------------------------------------------------------- -# The second stage container, for running the application -# --------------------------------------------------------------------- -FROM scratch - -WORKDIR /app/graphql - -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder /go/bin/graphql /go/bin/graphql -COPY cmd/graphql/init.sql . -COPY configs/*.yml /app/graphql/ - -ENTRYPOINT ["/go/bin/graphql"] diff --git a/build/sandbox/Dockerfile b/build/sandbox/Dockerfile new file mode 100644 index 000000000..13a4a0077 --- /dev/null +++ b/build/sandbox/Dockerfile @@ -0,0 +1,14 @@ +FROM node:latest AS build + +RUN git clone https://github.com/baking-bad/bcd.git /bcd + +WORKDIR /bcd +RUN yarn + +COPY .env.production . +RUN yarn build + +FROM nginx:latest AS release +COPY default.conf /etc/nginx/conf.d/default.conf +WORKDIR /usr/share/nginx/html/ +COPY --from=build /bcd/dist ./ \ No newline at end of file diff --git a/build/sandbox/default.conf b/build/sandbox/default.conf new file mode 100644 index 000000000..7fea3a5a0 --- /dev/null +++ b/build/sandbox/default.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html index.htm; + + location / { + try_files $uri /index.html; + } +} \ No newline at end of file diff --git a/build/sandbox/jupyter/Dockerfile b/build/sandbox/jupyter/Dockerfile deleted file mode 100644 index 6b4eefa85..000000000 --- a/build/sandbox/jupyter/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM bakingbad/michelson-kernel - -COPY build/sandbox/jupyter/notebooks /home/jupyter/notebooks - -ENTRYPOINT [ "jupyter", "notebook", "--ip=0.0.0.0", "--no-browser", "--no-mathjax"] - -CMD ["--NotebookApp.allow_origin=*", "--NotebookApp.port=8008", "--NotebookApp.default_url=/tree/notebooks", "--NotebookApp.disable_check_xsrf=True", "--NotebookApp.token="] diff --git a/build/sandbox/jupyter/notebooks/michelson_quickstart.ipynb b/build/sandbox/jupyter/notebooks/michelson_quickstart.ipynb deleted file mode 100644 index c8d56b190..000000000 --- a/build/sandbox/jupyter/notebooks/michelson_quickstart.ipynb +++ /dev/null @@ -1,93 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "parameter unit;\n", - "storage unit;" - ] - } - ], - "source": [ - "parameter unit;\n", - "storage unit;" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "code {\n", - " CDR ;\n", - " NIL operation ;\n", - " PAIR ;\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "RUN: use %default; drop all; push (Unit, Unit);\n", - " CDR: pop (Unit, Unit); push Unit;\n", - " NIL: push [];\n", - " PAIR: pop [], Unit; push ([], Unit);" - ] - }, - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
value type
Unit
unit
" - ], - "text/plain": [ - "value type\n", - "------- ------\n", - "Unit unit" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "RUN Unit Unit" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Michelson", - "language": "michelson", - "name": "michelson" - }, - "language_info": { - "codemirror_mode": "michelson", - "file_extension": ".tz", - "mimetype": "text/x-michelson", - "name": "Michelson" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/build/sandbox/jupyter/notebooks/pytezos_quickstart.ipynb b/build/sandbox/jupyter/notebooks/pytezos_quickstart.ipynb deleted file mode 100644 index 1214aecd2..000000000 --- a/build/sandbox/jupyter/notebooks/pytezos_quickstart.ipynb +++ /dev/null @@ -1,117 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "from pytezos import pytezos, Contract" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "alice = 'edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq'\n", - "sandboxnet = 'http://flextesa:20000'" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "pytezos = pytezos.using(shell=sandboxnet, key=alice)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "contract = Contract.from_michelson(\"\"\"\n", - "parameter (big_map string string);\n", - "storage (big_map string string);\n", - "code { CAR ; NIL operation ; PAIR }\n", - "\"\"\")" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'chain_id': 'NetXdQprcVkpaWU',\n", - " 'hash': 'ooUzn9wTSQC2orEKg3w4kT2DtFpeoVqb3bLYboBDtZqKpBuqfh9',\n", - " 'protocol': 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb',\n", - " 'branch': 'BMeU6N2esVp3LrjcU5LH5SXqiZuQpiwYE59yXYNKzu6WninD2wP',\n", - " 'contents': [{'kind': 'origination',\n", - " 'source': 'tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb',\n", - " 'fee': '1415',\n", - " 'counter': '1',\n", - " 'gas_limit': '11351',\n", - " 'storage_limit': '336',\n", - " 'balance': '0',\n", - " 'script': {'code': [{'prim': 'parameter',\n", - " 'args': [{'prim': 'big_map',\n", - " 'args': [{'prim': 'string'}, {'prim': 'string'}]}]},\n", - " {'prim': 'storage',\n", - " 'args': [{'prim': 'big_map',\n", - " 'args': [{'prim': 'string'}, {'prim': 'string'}]}]},\n", - " {'prim': 'code',\n", - " 'args': [[{'prim': 'CAR'},\n", - " {'prim': 'NIL', 'args': [{'prim': 'operation'}]},\n", - " {'prim': 'PAIR'}]]}],\n", - " 'storage': []}}],\n", - " 'signature': 'sigsXfAjgErCytMwQ5GLqG5XLGbmMHDLFXqXjnMDiEkRSUPQ6j1wq4FZkAEKHJCTNgkAPiF6vV7GuUkC5NLTdTy64Kcc3iub'}" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pytezos.origination(contract.script()).autofill().sign().inject()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.7" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/configs/sandbox.yml b/configs/sandbox.yml index 7c2bc4c9b..050b20fa2 100644 --- a/configs/sandbox.yml +++ b/configs/sandbox.yml @@ -29,7 +29,7 @@ api: mempool_enabled: false sandbox_mode: true rpc: - sandboxnet: ${SANDBOX_NODE_URI} + sandboxnet: "localhost:20000" seed: user: login: sandboxuser diff --git a/docker-compose.flextesa.yml b/docker-compose.flextesa.yml index 71f668427..d81c08a24 100644 --- a/docker-compose.flextesa.yml +++ b/docker-compose.flextesa.yml @@ -91,7 +91,7 @@ services: environment: - block_time=4 ports: - - "20000:20000" + - 127.0.0.1:20000:20000 expose: - 20000/tcp logging: *bcd-logging @@ -99,7 +99,7 @@ services: gui: container_name: sandbox-gui restart: always - image: bakingbad/bcdhub-gui:4.0 + image: ghcr.io/baking-bad/bcdhub-gui:${TAG} depends_on: - api ports: diff --git a/docker-compose.sandbox.yml b/docker-compose.sandbox.yml index 147256010..5aab66546 100644 --- a/docker-compose.sandbox.yml +++ b/docker-compose.sandbox.yml @@ -87,7 +87,7 @@ services: gui: container_name: sandbox-gui restart: always - image: bakingbad/bcdhub-gui:4.0 + image: ghcr.io/baking-bad/bcdhub-gui:${TAG} depends_on: - api ports: