Skip to content

Commit 7c3a82e

Browse files
authored
Merge pull request #76 from mikesir87/add-docs-ci-workflows
Add docs about deploying Labspaces in CI workflows
2 parents e3d9347 + 4e253c1 commit 7c3a82e

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This directory provides various documents on creating Labspaces.
66

77
- [Creating a Labspace](./creating-labspace.md) - start here to learn how to create a Labspace
88
- [Configuration](./configuration.md) - learn about the various configuration options to make the perfect Labspace
9+
- [Automating Labspace deployment](./deploying-in-ci.md) - learn how to publish your Compose file in CI for easy deployment
910
- [Best practices](./best-practices.md) - learn about a few best practices on creating Labspaces
1011

1112

docs/automating-deployment.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Automating Labspace Deployment
2+
3+
Recognizing a deployed Labspace is simply a published Compose file, it's fairly easy to do so in CI.
4+
5+
## Using GitHub Actions
6+
7+
Before publishing using GitHub Actions, you will need to do the following:
8+
9+
- Setup a `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` secret in GHA
10+
11+
The following workflow definition will publish to Hub using the `.labspace/compose.override.yaml` file. You will need to swap out the `YOUR-HUB-REPO-NAME-HERE` with the name of your Docker Hub repo.
12+
13+
```yaml
14+
name: Publish Labspace
15+
16+
on:
17+
push:
18+
branches:
19+
- main
20+
21+
jobs:
22+
build-and-push:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
# Ensure Compose v2.39.3+ is available (includes bug fixes for publishing)
29+
# Can remove this action once default runners include it
30+
- name: Set up Docker Compose
31+
uses: docker/setup-compose-action@v1
32+
with:
33+
version: v2.39.3
34+
35+
- name: Log in to DockerHub
36+
uses: docker/login-action@v3
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
41+
- name: Publish Compose file
42+
run: |
43+
docker compose -f oci://dockersamples/labspace -f .labspace/compose.override.yaml publish $DOCKERHUB_USERNAME/YOUR-HUB-REPO-NAME-HERE --with-env -y
44+
env:
45+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
46+
47+
```

0 commit comments

Comments
 (0)