Skip to content

Commit

Permalink
[bash] Update Bash Client Dockerfile.mustache (#9310)
Browse files Browse the repository at this point in the history
* Update Dockerfile.mustache

Using alpine instead of ubuntu for leaner Docker images.

Small fix for welcome message.

Changing default shell to `zsh` and fixing entrypoint.

* update samples

* move config, add new files

Co-authored-by: avbenavides <62693723+avbenavides@users.noreply.github.com>
  • Loading branch information
wing328 and avbenavides authored Apr 22, 2021
1 parent d773636 commit 946d145
Show file tree
Hide file tree
Showing 23 changed files with 357 additions and 332 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:16.10
FROM alpine:3.12.0

RUN apt-get update -y && apt-get full-upgrade -y
RUN apt-get install -y bash-completion zsh curl cowsay git vim bsdmainutils
RUN apk add --update --no-cache curl ca-certificates bash bash-completion zsh curl git vim ncurses util-linux

ADD {{scriptName}} /usr/bin/{{scriptName}}
ADD _{{scriptName}} /usr/local/share/zsh/site-functions/_{{scriptName}}
Expand Down Expand Up @@ -30,7 +29,7 @@ RUN echo 'export PROMPT="[{{appName}}] \$ "' >> ~/.zshrc
#
# Setup a welcome message with basic instruction
#
RUN echo 'cat << EOF\n\
RUN echo -e 'echo "\
\n\
This Docker provides preconfigured environment for running the command\n\
line REST client for $(tput setaf 6){{appName}}$(tput sgr0).\n\
Expand Down Expand Up @@ -63,7 +62,14 @@ $ {{scriptName}} <operationId> -h\n\
By default you are logged into Zsh with full autocompletion for your REST API,\n\
but you can switch to Bash, where basic autocompletion is also supported.\n\
\n\
EOF\n\
"\
' | tee -a ~/.bashrc ~/.zshrc

ENTRYPOINT ["zsh"]
#
# Poormans chsh & cleanup to make image as compact as possible
#

RUN sed -i 's/root:x:0:0:root:\/root:\/bin\/ash/root:x:0:0:root:\/root:\/bin\/zsh/' /etc/passwd
RUN apk del git vim && rm -f /var/cache/apk/*

ENTRYPOINT ["/bin/zsh"]
59 changes: 59 additions & 0 deletions samples/client/petstore/bash/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Dockerfile
README.md
_petstore-cli
docs/$special[modelName].md
docs/200Response.md
docs/AdditionalPropertiesAnyType.md
docs/AdditionalPropertiesArray.md
docs/AdditionalPropertiesBoolean.md
docs/AdditionalPropertiesClass.md
docs/AdditionalPropertiesInteger.md
docs/AdditionalPropertiesNumber.md
docs/AdditionalPropertiesObject.md
docs/AdditionalPropertiesString.md
docs/Animal.md
docs/AnotherFakeApi.md
docs/ApiResponse.md
docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/BigCat.md
docs/BigCatAllOf.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ClassModel.md
docs/Client.md
docs/Dog.md
docs/DogAllOf.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/File.md
docs/FileSchemaTestClass.md
docs/FormatTest.md
docs/HasOnlyReadOnly.md
docs/List.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Name.md
docs/NumberOnly.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/Pet.md
docs/PetApi.md
docs/ReadOnlyFirst.md
docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TypeHolderDefault.md
docs/TypeHolderExample.md
docs/User.md
docs/UserApi.md
docs/XmlItem.md
petstore-cli
petstore-cli.bash-completion
2 changes: 1 addition & 1 deletion samples/client/petstore/bash/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2-SNAPSHOT
5.1.1-SNAPSHOT
19 changes: 12 additions & 7 deletions samples/client/petstore/bash/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:16.10
FROM alpine:3.12.0

RUN apt-get update -y && apt-get full-upgrade -y
RUN apt-get install -y bash-completion zsh curl cowsay git vim bsdmainutils
RUN apk add --update --no-cache curl ca-certificates bash bash-completion zsh curl git vim ncurses util-linux

ADD petstore-cli /usr/bin/petstore-cli
ADD _petstore-cli /usr/local/share/zsh/site-functions/_petstore-cli
Expand Down Expand Up @@ -30,7 +29,7 @@ RUN echo 'export PROMPT="[OpenAPI Petstore] \$ "' >> ~/.zshrc
#
# Setup a welcome message with basic instruction
#
RUN echo 'cat << EOF\n\
RUN echo -e 'echo "\
\n\
This Docker provides preconfigured environment for running the command\n\
line REST client for $(tput setaf 6)OpenAPI Petstore$(tput sgr0).\n\
Expand All @@ -41,7 +40,6 @@ $(tput setaf 3)PETSTORE_HOST$(tput sgr0) - server URL, e.g. https://example.com:
$(tput setaf 3)PETSTORE_API_KEY$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\
$(tput setaf 3)PETSTORE_API_KEY$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\
$(tput setaf 3)PETSTORE_BASIC_AUTH$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\
$(tput setaf 3)PETSTORE_BASIC_AUTH$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\
\n\
$(tput setaf 7)Basic usage:$(tput sgr0)\n\
\n\
Expand All @@ -57,7 +55,14 @@ $ petstore-cli <operationId> -h\n\
By default you are logged into Zsh with full autocompletion for your REST API,\n\
but you can switch to Bash, where basic autocompletion is also supported.\n\
\n\
EOF\n\
"\
' | tee -a ~/.bashrc ~/.zshrc

ENTRYPOINT ["zsh"]
#
# Poormans chsh & cleanup to make image as compact as possible
#

RUN sed -i 's/root:x:0:0:root:\/root:\/bin\/ash/root:x:0:0:root:\/root:\/bin\/zsh/' /etc/passwd
RUN apk del git vim && rm -f /var/cache/apk/*

ENTRYPOINT ["/bin/zsh"]
42 changes: 19 additions & 23 deletions samples/client/petstore/bash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ All URIs are relative to */v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
Expand All @@ -111,9 +110,9 @@ Class | Method | HTTP request | Description
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
假端點
偽のエンドポイント
가짜 엔드 포인트
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
Expand Down Expand Up @@ -145,13 +144,23 @@ Class | Method | HTTP request | Description

## Documentation For Models

- [$special[modelName]](docs/$special[modelName].md)
- [200Response](docs/200Response.md)
- [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
- [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
- [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
- [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
- [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
- [AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
- [Animal](docs/Animal.md)
- [ApiResponse](docs/ApiResponse.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [BigCat](docs/BigCat.md)
- [BigCatAllOf](docs/BigCatAllOf.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [CatAllOf](docs/CatAllOf.md)
Expand All @@ -163,35 +172,26 @@ Class | Method | HTTP request | Description
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
- [File](docs/File.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Foo](docs/Foo.md)
- [FormatTest](docs/FormatTest.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [HealthCheckResult](docs/HealthCheckResult.md)
- [InlineObject](docs/InlineObject.md)
- [InlineObject1](docs/InlineObject1.md)
- [InlineObject2](docs/InlineObject2.md)
- [InlineObject3](docs/InlineObject3.md)
- [InlineObject4](docs/InlineObject4.md)
- [InlineObject5](docs/InlineObject5.md)
- [InlineResponseDefault](docs/InlineResponseDefault.md)
- [List](docs/List.md)
- [MapTest](docs/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Name](docs/Name.md)
- [NullableClass](docs/NullableClass.md)
- [NumberOnly](docs/NumberOnly.md)
- [Order](docs/Order.md)
- [OuterComposite](docs/OuterComposite.md)
- [OuterEnum](docs/OuterEnum.md)
- [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [OuterEnumInteger](docs/OuterEnumInteger.md)
- [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [Pet](docs/Pet.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Return](docs/Return.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [TypeHolderDefault](docs/TypeHolderDefault.md)
- [TypeHolderExample](docs/TypeHolderExample.md)
- [User](docs/User.md)
- [XmlItem](docs/XmlItem.md)


## Documentation For Authorization
Expand All @@ -211,10 +211,6 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key_query
- **Location**: URL query string

## bearer_test

- **Type**: HTTP basic authentication

## http_basic_test

- **Type**: HTTP basic authentication
Expand Down
19 changes: 7 additions & 12 deletions samples/client/petstore/bash/_petstore-cli
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ case $state in
ops)
# Operations
_values "Operations" \
"call123TestSpecialTags[To test special tags]" "fooGet[]" "fakeHealthGet[Health check endpoint]" \
"call123TestSpecialTags[To test special tags]" "createXmlItem[creates an XmlItem]" \
"fakeOuterBooleanSerialize[]" \
"fakeOuterCompositeSerialize[]" \
"fakeOuterNumberSerialize[]" \
Expand All @@ -305,9 +305,9 @@ case $state in
"testBodyWithQueryParams[]" \
"testClientModel[To test \"client\" model]" \
"testEndpointParameters[Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트]" \
假端點
偽のエンドポイント
가짜 엔드 포인트]" \
"testEnumParameters[To test enum parameters]" \
"testGroupParameters[Fake endpoint to test group parameters (optional)]" \
"testInlineAdditionalProperties[test inline additionalProperties]" \
Expand All @@ -330,7 +330,8 @@ case $state in
"getUserByName[Get user by user name]" \
"loginUser[Logs user into the system]" \
"logoutUser[Logs out current logged in user session]" \
"updateUser[Updated user]"
"updateUser[Updated user]" \

_arguments "(--help)--help[Print information about operation]"

ret=0
Expand All @@ -343,13 +344,7 @@ case $state in
)
_describe -t actions 'operations' _op_arguments -S '' && ret=0
;;
fooGet)
local -a _op_arguments
_op_arguments=(
)
_describe -t actions 'operations' _op_arguments -S '' && ret=0
;;
fakeHealthGet)
createXmlItem)
local -a _op_arguments
_op_arguments=(
)
Expand Down
13 changes: 11 additions & 2 deletions samples/client/petstore/bash/docs/AdditionalPropertiesClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapUnderscoreproperty** | **map[String, string]** | | [optional] [default to null]
**mapUnderscoreofUnderscoremapUnderscoreproperty** | **map[String, map[String, string]]** | | [optional] [default to null]
**mapUnderscorestring** | **map[String, string]** | | [optional] [default to null]
**mapUnderscorenumber** | **map[String, integer]** | | [optional] [default to null]
**mapUnderscoreinteger** | **map[String, integer]** | | [optional] [default to null]
**mapUnderscoreboolean** | **map[String, boolean]** | | [optional] [default to null]
**mapUnderscorearrayUnderscoreinteger** | **map[String, array[integer]]** | | [optional] [default to null]
**mapUnderscorearrayUnderscoreanytype** | **map[String, array[map]]** | | [optional] [default to null]
**mapUnderscoremapUnderscorestring** | **map[String, map[String, string]]** | | [optional] [default to null]
**mapUnderscoremapUnderscoreanytype** | **map[String, map[String, map]]** | | [optional] [default to null]
**anytypeUnderscore1** | **map** | | [optional] [default to null]
**anytypeUnderscore2** | **map** | | [optional] [default to null]
**anytypeUnderscore3** | **map** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/bash/docs/AnotherFakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ petstore-cli call123TestSpecialTags

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md) | client model |
**body** | [**Client**](Client.md) | client model |

### Return type

Expand Down
13 changes: 13 additions & 0 deletions samples/client/petstore/bash/docs/BigCat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# BigCat

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**className** | **string** | | [default to null]
**color** | **string** | | [optional] [default to red]
**declawed** | **boolean** | | [optional] [default to null]
**kind** | **string** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


10 changes: 10 additions & 0 deletions samples/client/petstore/bash/docs/BigCatAllOf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# BigCat_allOf

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**kind** | **string** | | [optional] [default to null]

[[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: 0 additions & 3 deletions samples/client/petstore/bash/docs/EnumTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Name | Type | Description | Notes
**enumUnderscoreinteger** | **integer** | | [optional] [default to null]
**enumUnderscorenumber** | **float** | | [optional] [default to null]
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null]
**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] [default to null]
**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to null]
**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Loading

0 comments on commit 946d145

Please sign in to comment.