Skip to content

Commit 5036c57

Browse files
committed
Add docker build push to ghcr workflow
1 parent 654a2b8 commit 5036c57

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build-and-push:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to GitHub Container Registry
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata (tags, labels)
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=ref,event=branch
46+
type=ref,event=pr
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=semver,pattern={{major}}
50+
type=sha
51+
52+
- name: Build and push Docker image
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: .
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,38 @@ The app will be available at `http://localhost:8080`
4444
]
4545
```
4646

47+
3. The `public/config.json` file is gitignored to keep credentials safe.
48+
4749
## Docker Deployment
4850

49-
When deploying with Docker, mount your `config.json` as a volume:
51+
### Using Pre-built Image from GHCR
52+
53+
Pull and run the latest image from GitHub Container Registry:
54+
55+
```bash
56+
docker run -d -p 8080:80 \
57+
-v $(pwd)/public/config.json:/usr/share/nginx/html/config.json:ro \
58+
ghcr.io/mskcc/cellxgene-dash:main
59+
```
60+
61+
Or update `docker-compose.yml` to use the pre-built image:
62+
63+
```yaml
64+
version: '3.8'
65+
66+
services:
67+
cellxgene-dash:
68+
image: ghcr.io/mskcc/cellxgene-dash:main
69+
ports:
70+
- "8080:80"
71+
volumes:
72+
- ./public/config.json:/usr/share/nginx/html/config.json:ro
73+
restart: unless-stopped
74+
```
75+
76+
### Building Locally
77+
78+
When building locally, mount your `config.json` as a volume:
5079

5180
```bash
5281
docker run -d -p 8080:80 \

0 commit comments

Comments
 (0)