Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CH-142 Add dockerfile build args support to apps #763

Merged
merged 7 commits into from
Aug 28, 2024
3 changes: 3 additions & 0 deletions applications/samples/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG CLOUDHARNESS_FLASK

FROM $CLOUDHARNESS_FRONTEND_BUILD as frontend

ARG TEST_ARGUMENT=default
RUN echo $TEST_ARGUMENT

ENV APP_DIR=/app

WORKDIR ${APP_DIR}
Expand Down
4 changes: 3 additions & 1 deletion applications/samples/deploy/values-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ harness:
soft: []
hard: []
use_services: []

dockerfile:
buildArgs:
TEST_ARGUMENT: 'minimal value'
4 changes: 4 additions & 0 deletions applications/samples/deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,7 @@ harness:
- "--request-timeout=180000"
- "--hypothesis-max-examples=2"
- "--show-errors-tracebacks"

dockerfile:
buildArgs:
TEST_ARGUMENT: example value
2 changes: 2 additions & 0 deletions docs/applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ The most important configuration entries are the following:
- `use_services` (`{name, src, dst}[]`): create reverse proxy endpoints in the ingress for the listed applications on [subdomain].[Values.domain]/proxy/[name]. Useful to avoid CORS requests from frontend clients
- `readinessProbe`: defines a a url to use as a readiness probe
- `livenessProbe`: defines a a url to use as a liveness probe
- `dockerfile`: configuration for the dockerfile, currently only implemented in Skaffold
- `buildArgs`: a map of build arguments to provide to the dockerfile when building with Skaffold

# Example code
- [Sample application](../../applications/samples) is a sample web application providing working examples of deployment configuration, backend and frontend code.
Expand Down
4 changes: 4 additions & 0 deletions docs/build-deploy/ci-cd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ All you need to to is:
- Run `skaffold build`
- Run `skaffold run`

### Dockerfile configuration with Skaffold

When defining an applications values you can provide details on dockerfile configuration such as build arguments. This feature is intended to support useful development use cases (e.g. conditionally running unit tests via build arguments) and should be used with caution as it can lead to different images in different deployment environments.

## CI/CD with Codefresh

[Codefresh](https://codefresh.io/) is a nice platform for CI/CD see details in the [dedicated document](./codefresh.md).
3 changes: 3 additions & 0 deletions docs/model/ApplicationHarnessConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Name | Type | Description | Notes
**accounts** | [**ApplicationAccountsConfig**](ApplicationAccountsConfig.md) | | [optional]
**test** | [**ApplicationTestConfig**](ApplicationTestConfig.md) | | [optional]
**quotas** | **Dict[str, object]** | | [optional]
**env** | [**List[NameValue]**](NameValue.md) | Environmental variables added to all containers (deprecated, please use envmap) | [optional]
**envmap** | **Dict[str, object]** | | [optional]
**dockerfile** | [**DockerfileConfig**](DockerfileConfig.md) | | [optional]

## Example

Expand Down
30 changes: 30 additions & 0 deletions docs/model/DockerfileConfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# DockerfileConfig

Configuration for a dockerfile

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**build_args** | **Dict[str, object]** | | [optional]

## Example

```python
from cloudharness_model.models.dockerfile_config import DockerfileConfig

# TODO update the JSON string below
json = "{}"
# create an instance of DockerfileConfig from a JSON string
dockerfile_config_instance = DockerfileConfig.from_json(json)
# print the JSON string representation of the object
print DockerfileConfig.to_json()

# convert the object into a dict
dockerfile_config_dict = dockerfile_config_instance.to_dict()
# create an instance of DockerfileConfig from a dict
dockerfile_config_form_dict = dockerfile_config.from_dict(dockerfile_config_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


3 changes: 1 addition & 2 deletions docs/model/HarnessMainConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ Name | Type | Description | Notes
**registry** | [**RegistryConfig**](RegistryConfig.md) | | [optional]
**tag** | **str** | Docker tag used to push/pull the built images. | [optional]
**apps** | [**Dict[str, ApplicationConfig]**](ApplicationConfig.md) | |
**env** | [**List[NameValue]**](NameValue.md) | Environmental variables added to all pods (deprecated, please use envmap) | [optional]
**env** | [**List[NameValue]**](NameValue.md) | Environmental variables added to all pods | [optional]
**privenv** | [**NameValue**](NameValue.md) | | [optional]
**backup** | [**BackupConfig**](BackupConfig.md) | | [optional]
**name** | **str** | Base name | [optional]
**task_images** | **Dict[str, object]** | | [optional]
**build_hash** | **str** | | [optional]
**envmap** | **Dict[str, object]** | | [optional]

## Example

Expand Down
Loading
Loading