Skip to content

Commit

Permalink
Automate docker build/deploy to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Dec 18, 2024
1 parent edb9dc5 commit 8831150
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 33 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docker image deploy

on:
push:
branches:
- main
paths:
- "backend/**"
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag'
required: true
default: 'latest'

jobs:
vercel-deploy:
name: Vercel deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Builder
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
run: |
cd backend/
INPUT_TAG=${{ github.event.inputs.tag }}
TAG=${INPUT_TAG:-"latest"}
docker build -t ghcr.io/flatironinstitute/stan-wasm-server:$TAG .
docker push ghcr.io/flatironinstitute/stan-wasm-server:$TAG
38 changes: 16 additions & 22 deletions .github/workflows/vercel_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- vercel-deploy-2 # for initial test
# manual trigger
workflow_dispatch:

Expand All @@ -13,24 +12,19 @@ jobs:
name: Vercel deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
-
name: Install Vercel CLI
run: npm install --global vercel@latest
-
name: Create .vercel/project.json
run: |
cd gui
mkdir -p .vercel
echo '{"projectId":"${{ secrets.VERCEL_PROJECT_ID }}", "orgId":"${{ secrets.VERCEL_ORG_ID }}"}' > .vercel/project.json
-
name: Pull Vercel Environment Information
run: |
cd gui
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
-
name: Build Project Artifacts
run: |
cd gui
vercel --prod --token=${{ secrets.VERCEL_TOKEN }}
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Create .vercel/project.json
run: |
cd gui
mkdir -p .vercel
echo '{"projectId":"${{ secrets.VERCEL_PROJECT_ID }}", "orgId":"${{ secrets.VERCEL_ORG_ID }}"}' > .vercel/project.json
- name: Pull Vercel Environment Information
run: |
cd gui
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: |
cd gui
vercel --prod --token=${{ secrets.VERCEL_TOKEN }}
9 changes: 0 additions & 9 deletions backend/build_and_push.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docs/compilation_server_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ These instructions are only required if you want to set up your own compilation
To run your own server locally using Docker, execute the following command:

```
docker run -p 8083:8080 -it magland/stan-wasm-server:latest
docker run -p 8083:8080 -it ghcr.io/flatironinstitute/stan-wasm-server:latest
```

After setting up the server, navigate to https://stan-playground.flatironinstitute.org.
Expand Down
3 changes: 2 additions & 1 deletion gui/src/app/Compilation/Control/CompilationServerDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ const ConfigureCompilationServerDialog: FunctionComponent<
</p>
<div>
<pre>
docker run -p 8083:8080 -it magland/stan-wasm-server:latest
docker run -p 8083:8080 -it
ghcr.io/flatironinstitute/stan-wasm-server:latest
</pre>
</div>
</div>
Expand Down

0 comments on commit 8831150

Please sign in to comment.