An open API service indexing awesome lists of open source software.

https://github.com/dockersamples/publish-labspace-action


https://github.com/dockersamples/publish-labspace-action

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# Publish Labspace Action

A GitHub Action that packages and deploys your Labspace.

## What it does

This action:

1. Sets up a known-working version of Docker Compose
2. Creates a base64-encoded tarball of the content in the repository
3. Generates a temporary `compose.pipeline.yaml` file with:
- A `project_source_tar` config containing the base64-encoded tarball
- Mounts the tarball into the `configurator` service and sets the `PROJECT_TAR_PATH` environment variable pointing to the mounted tarball
4. Publishes the Compose file using `docker compose publish`

## Prerequisites

Your repository must follow the structure provided in the dockersamples/labspace-starter repo:

1. Have a `compose.overrides.yaml` file
2. Store the Labspace project in the `project` directory
3. Store the Labspace instructions and `labspace.yaml` in the `labspace` directory

## Configuration

### Inputs

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `target_repo` | The repo where the Compose file should be published | Yes | - |
| `target_tag` | The tag for the Compose file should be published | No | `latest` |
| `labspace_base_version` | The version of the base Labspace Compose file | No | `latest` |
| `labspace_override_files` | Paths to Labspace-specific Compose override files, comma separated | No | `compose.overrides.yaml` |

## Usage

```yaml
name: Publish Labspace

on:
push:
branches: [ main ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish Labspace
uses: dockersamples/publish-labspace-action@v1
with:
target_repo: dockersamples/labspace-demo
```

## How it works

The action creates a Docker Compose override file that embeds your project source code as a base64-encoded tarball. This tarball is then available to the `configurator` service at runtime through the `PROJECT_TAR_PATH` environment variable.

The generated `compose.pipeline.yaml` structure:

```yaml
configs:
project_source_tar:
content: |

services:
configurator:
configs:
- source: project_source_tar
target: /etc/labspace-support/content.tar.base64
environment:
PROJECT_TAR_PATH: /etc/labspace-support/content.tar.base64
```