# Prepare a sandbox image from a Dockerfile

> Builds the recipe, or reuses the organization's build of the same recipe, and lists the image in workspace_id (default main). Requires developer access to the workspace.



## OpenAPI

````yaml ${THUNDER_API_BASE}/openapi.json post /sandbox-images/from-dockerfile
openapi: 3.1.0
info:
  contact:
    email: support@thundercompute.one
    name: Thunder Compute API Support
    url: https://www.thundercompute.one/contact
  description: >-
    Retrieve current GPU availability using mode-less spec keys

    Recommended for new integrations. The /status and /v1/status endpoints
    retain their legacy configuration keys for compatibility.
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: Thunder Compute API
  version: '1.0'
servers:
  - description: Production server
    url: ${THUNDER_API_BASE}/v1
  - description: Production server
    url: ${THUNDER_API_BASE}
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /sandbox-images/from-dockerfile:
    post:
      tags:
        - Sandbox Images
      summary: Prepare a sandbox image from a Dockerfile
      description: >-
        Builds the recipe, or reuses the organization's build of the same
        recipe, and lists the image in workspace_id (default main). Requires
        developer access to the workspace.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/thundertypes.SandboxImageDockerfileRequest'
              summary: body
              description: Canonical build recipe
        description: Canonical build recipe
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.SandboxImageResponse'
          description: OK
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.SandboxImageResponse'
          description: Accepted
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Forbidden
      security:
        - ApiKeyAuth: []
components:
  schemas:
    thundertypes.SandboxImageDockerfileRequest:
      properties:
        archive_bytes:
          type: integer
        build_options_hash:
          type: string
        context_hash:
          type: string
        display_name:
          type: string
        dockerfile_hash:
          type: string
        gatedFeatures:
          additionalProperties: {}
          type: object
        mode:
          description: >-
            Mode is "container" (the default) or "vm", which builds the image to
            boot

            as the whole VM. Images of one mode only start sandboxes of that
            mode.
          type: string
        queue:
          description: Queue admits the build without checking future sandbox capacity.
          type: boolean
        recipe_hash:
          type: string
        registry_host:
          description: >-
            RegistryHost, RegistryUsername and RegistryPassword optionally

            authenticate the build's base-image pulls (the Dockerfile's FROM).

            Username and password come together, with the host of the registry
            they

            are for; the build offers them to no other registry.
          type: string
        registry_password:
          type: string
        registry_username:
          type: string
        spec:
          $ref: '#/components/schemas/thundertypes.SandboxResourceSpec'
          description: >-
            Spec optionally describes the intended sandbox for a best-effort
            capacity check.

            New builds without it do not receive the automatic first-sandbox
            queue allowance.
        ssh_public_key:
          type: string
        workspace_id:
          description: >-
            WorkspaceID lists the image in this workspace (default main);
            building requires developer access there.
          form: workspace_id
          type: string
      required:
        - archive_bytes
        - build_options_hash
        - context_hash
        - dockerfile_hash
        - recipe_hash
        - ssh_public_key
      type: object
    thundertypes.SandboxImageResponse:
      properties:
        attempt:
          type: integer
        created_at:
          type: string
        display_name:
          type: string
        failure:
          type: string
        failure_code:
          type: string
        id:
          type: string
        managed_digest:
          type: string
        managed_reference:
          type: string
        mode:
          $ref: '#/components/schemas/thundertypes.SandboxMode'
          description: >-
            Mode is "vm" for an image built to boot as the whole VM, and omitted
            for

            container images.
        size_bytes:
          type: integer
        source_type:
          type: string
        state:
          $ref: '#/components/schemas/thundertypes.SandboxImageState'
        updated_at:
          type: string
        upload:
          $ref: '#/components/schemas/thundertypes.SandboxImageUpload'
        workspace_id:
          type: string
      type: object
    thundertypes.ErrorResponse:
      properties:
        code:
          example: 400
          type: integer
        error:
          example: invalid_request
          type: string
        message:
          example: The request is malformed
          type: string
      type: object
    thundertypes.SandboxResourceSpec:
      properties:
        cpu_count:
          type: integer
        gpu_count:
          type: integer
        gpu_type:
          $ref: '#/components/schemas/thundertypes.SandboxGPUType'
        memory_gib:
          type: integer
        storage_gib:
          type: integer
      required:
        - cpu_count
        - memory_gib
        - storage_gib
      type: object
    thundertypes.SandboxMode:
      enum:
        - container
        - vm
      type: string
      x-enum-varnames:
        - SandboxModeContainer
        - SandboxModeVM
    thundertypes.SandboxImageState:
      enum:
        - BUILDING
        - READY
        - FAILED
      type: string
      x-enum-varnames:
        - SandboxImageStateBuilding
        - SandboxImageStateReady
        - SandboxImageStateFailed
    thundertypes.SandboxImageUpload:
      properties:
        expires_at:
          type: string
        host:
          type: string
        host_public_key:
          type: string
        path:
          type: string
        port:
          type: integer
        username:
          type: string
      type: object
    thundertypes.SandboxGPUType:
      enum:
        - A6000
        - A100
        - A100XL
        - H100
      type: string
      x-enum-varnames:
        - SandboxGPUTypeA6000
        - SandboxGPUTypeA100
        - SandboxGPUTypeA100XL
        - SandboxGPUTypeH100
  securitySchemes:
    ApiKeyAuth:
      description: >-
        Bearer token authentication. Provide your API token prefixed with
        "Bearer ", e.g. "Bearer your-api-token".
      in: header
      name: Authorization
      type: apiKey

````
