Sign inSign up

dockersamples/labspace-content-dev:v0.29.0

Manifest digest

sha256:cb9cfc1830952604779024110396ad2f4ded725067cf7bbc72c713c9ac67c1a4

Last pushed

4 months by dockersamplesbuildbot

Type

Compose

Manifest digest

sha256:cb9cfc1830952604779024110396ad2f4ded725067cf7bbc72c713c9ac67c1a4

Compose file content

##################################################################################################
# This Compose file is intended to run a Labspace. It can be run with the following:
#
# CONTENT_REPO_URL=https://github.com/username/labspace-content-repo docker compose -f compose.run.yaml up
##################################################################################################

services:
  configurator:
    image: dockersamples/labspace-configurator:v0.29.0
    use_api_socket: true
    volumes:
      - labspace-content:/project
      - labspace-instructions:/instructions
      - docker-creds:/docker-creds
      - labspace-support:/etc/labspace-support

  interface:
    image: dockersamples/labspace-interface:v0.29.0
    ports:
      - "3030:3030"
    volumes:
      - labspace-instructions:/labspace/instructions:ro
      - type: volume
        source: labspace-support
        target: /etc/labspace-support/private-key
        volume:
          subpath: private-key
      - type: volume
        source: labspace-support
        target: /etc/labspace-support/socket
        volume:
          subpath: socket
      - type: volume
        source: labspace-support
        target: /etc/labspace-support/metadata
        volume:
          subpath: metadata
    depends_on:
      workspace:
        condition: service_started
      configurator:
        condition: service_completed_successfully
    restart: unless-stopped

  workspace:
    image: dockersamples/labspace-workspace-node:v0.29.0
    depends_on:
      configurator:
        condition: service_completed_successfully
      socket-proxy:
        condition: service_started
    ports:
      - 8085:8085 # For the IDE itself
      - 3000:3000 # For the Node application running in the IDE
    volumes:
      - socket-proxy:/var/run
      - labspace-content:/home/coder/project
      - docker-creds:/docker-creds
      - type: volume
        source: labspace-support
        target: /etc/labspace-support/public-key
        volume:
          subpath: public-key
      - type: volume
        source: labspace-support
        target: /etc/labspace-support/socket
        volume:
          subpath: socket


  host-republisher:
    image: dockersamples/labspace-host-port-republisher:v0.29.0
    pull_policy: always
    restart: always
    volumes:
      - socket-proxy:/var/run
    network_mode: service:workspace
    environment:
      LABEL_FILTER: labspace-resource=true
    depends_on:
      - workspace
      - socket-proxy

  workspace-cleaner:
    image: dockersamples/labspace-cleaner:v0.29.0
    pull_policy: always
    volumes:
      - socket-proxy:/var/run
    environment:
      LABEL_FILTER: labspace-resource=true
    depends_on:
      - socket-proxy

  socket-proxy:
    image: mikesir87/docker-socket-proxy:v1.3.1
    volumes:
      - socket-proxy:/tmp/proxy
      - /var/run/docker.sock:/var/run/docker.sock
    configs:
      - source: docker-proxy-config-labels
        target: /etc/docker-socket-proxy/config.d/add-and-require-labels.yaml
      - source: docker-proxy-mount-remap
        target: /etc/docker-socket-proxy/config.d/mount-path-remap.yaml
      - source: docker-proxy-mount-allowlist
        target: /etc/docker-socket-proxy/config.d/mount-path-allowlist.yaml
      - source: docker-proxy-forward-proxied-socket
        target: /etc/docker-socket-proxy/config.d/forward-proxied-socket.yaml
      - source: docker-proxy-add-to-labspace-network
        target: /etc/docker-socket-proxy/config.d/add-to-labspace-network.yaml
    environment:
      DEBUG_LOGS: "true"
      LISTEN_SOCKET_PATH: /tmp/proxy/docker.sock

volumes:
  socket-proxy:
    name: labspace-socket-proxy
  labspace-content:
    name: labspace-content
  labspace-instructions:
  docker-creds:
  labspace-support:

networks:
  default:
    name: labspace

configs:
  docker-proxy-config-labels:
    content: |
      mutators:
        # Add labels to all newly created objects
        - type: addLabels
          labels:
            labspace-resource: "true"
      responseFilters:
        # Only return objects with the labels we mutated on
        - type: labelFilter
          objectsToFilter:
            - containers
            - volumes
            - networks
          requiredLabels:
            labspace-resource: "true"
  docker-proxy-mount-remap:
    content: |
      # Remap the project directory to the labspace content volume, since the project
      # is running out of a volume.
      mutators:
        - type: mountPath
          from: /home/coder/project
          to: labspace-content
  docker-proxy-mount-allowlist:
    content: |
      gates:
        - type: mountSource
          allowedSources:
            - labspace-content
            - labspace-socket-proxy
            - buildx_buildkit_default_state
            - label:labspace-resource=true
  docker-proxy-forward-proxied-socket:
    content: |
      # If requests to use the Docker Socket are used (such as Testcontainers),
      # use the proxied one to ensure permissions, remappings, etc. are applied
      mutators:
        - type: mountPath
          from: /var/run/docker.sock
          to: labspace-socket-proxy/docker.sock
  docker-proxy-add-to-labspace-network:
    content: |
      mutators:
        - type: addToNetwork
          networks:
            - labspace
##################################################################################################
# This Compose file provides the overrides needed to develop Labspace content.
#
# This variant will mount in the source content into the configurator, where it will then be
# copied into the volume that is shared with the rest of the labspace. This allows you to run through
# the lab, making changes to files, running startup scripts, and more without polluting the actual
# content. Compose Watch will monitor the content directory for changes and sync them into the
# workspace, which shares the volume with the interface.
#
# The CONTENT_PATH environment variable is being used here because we are unable to simply use
# a relative path (such as "./"). When running the Compose stack via a published OCI artifact,
# the working directory is not the same as the location of the Compose files, which is its cached
# location on the host filesystem. Therefore, the paths would not resolve correctly.
##################################################################################################

services:
  configurator:
    volumes:
      - $CONTENT_PATH:/dev-content:ro
    environment:
      DEV_MODE: true

  interface:
    environment:
      CONTENT_DEV_MODE: true
    volumes:
      # Remove the read-only flag since watch will be syncing changes
      - labspace-instructions:/labspace/instructions
    develop:
      watch:
        - path: $CONTENT_PATH/labspace
          action: sync
          target: /labspace/instructions

  workspace:
    develop:
      watch:
        - path: $CONTENT_PATH/project
          action: sync
          target: /home/coder/project

Docker commands

docker compose -f oci://dockersamples/labspace-content-dev:v0.29.0 up

Use the above command to pull and run the Compose file. Learn more.

Images used

Image


Pulls

10K+

Stars

0

Last Updated

2 months

Image


Pulls

10K+

Stars

0

Last Updated

2 months

Image


Pulls

10K+

Stars

0

Last Updated

2 months

Image


Pulls

10K+

Stars

0

Last Updated

2 months

Image


Pulls

10K+

Stars

0

Last Updated

2 months

Image


Pulls

10K+

Stars

0

Last Updated

7 months