Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Config: Build with docker #6

Open
Labels
enhancementNew feature or request
@trykovyura

Description

Hi, thanks for great tool! Trying to customise build configuration, but found some issues and i need some help.

Use cases

  • Build monorepo with nextjs
  • Respository structure is classic for turborepo
  • Have several apps to build with docker and deploy with serverless container
Image

Build config

name: example
deployment:
 type: awsApi@1.0
containers:
 example-docs:
 src: ./apps/example-docs
 routing:
 domain: dev-docs.example.com
 pathPattern: /*
 pathHealthCheck: /api/health
 environment:
 HELLO: world
 compute:
 type: awsFargateEcs
 example-web:
 src: ./apps/example-web
 compute:
 type: awsFargateEcs
 awsFargateEcs:
 cpu: 256
 memory: 512
 build:
 args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
 key: value # Example: ARG key=value
 dockerFileString: ./apps/example-web/Dockerfile
 routing:
 domain: dev-web.example.com
 pathPattern: /*
 pathHealthCheck: /api/health
 environment:
 HELLO: world

Build error

When i try to deploy this config - it errors with on serverless deploy

  • Unrecognized key(s): build
{
 "source": "sfcore.analysis.generated.v1",
 "event": {
 "actionSucceeded": false,
 "operatingSystem": "linux",
 "architecture": "x64",
 "cicd": true,
 ...
 "isCompose": false,
 "projectType": "containers",
 "cliOptions": [
 "stage",
 "debug"
 ],
 "source": "serverless@4.6.2",
 "actionName": "deploy",
 "configurationFileName": "serverless.containers.yml",
 "resolvers": [],
 "error": {
 "name": "Error",
 "message": "Invalid configuration:\n\n - Unrecognized key(s): build\n\n",
 "code": "INVALID_CONFIGURATION"
 }
 }
 }

Build error analysis

containers:
 my-container:
 src: ./path/to/container # Required: Path to the container source code.
 compute: # Required: Compute configuration.
 build: # Optional: Build configuration.
 environment: # Optional: Environment variables to pass to the container.
 routing: # Required: Routing configuration.
 dev: # Optional: Development mode configuration
  • Actual
example-web:
 src: ./apps/example-web
 compute:
 build:
 args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
 key: value # Example: ARG key=value
 dockerFileString: ./apps/example-web/Dockerfile
  • Could not find source code to check - is it opensoured?
  • Main hypothesis - looks like a bug 🐛

Docker examples?

More bugs?

  • hypothesis that dockerFileString -> supposed to be dockerFile as is see in serverless configuration

Proposual for configuration update

Add build context to separate src and context

build:
 args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
 key: value # Example: ARG key=value
 dockerFileString: # Optional: Dockerfile as a string to use for the container (not recommended, prefer
 context: # Optional: Build context for docker file```

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /