Skip to content

Commit

Permalink
Merge pull request #401 from HewlettPackard/Upgrade_in_DockerFile
Browse files Browse the repository at this point in the history
Added packages to clean in DockerFile
  • Loading branch information
chebroluharika committed May 12, 2020
2 parents 9262001 + ad53b3d commit b1832f4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
@@ -1,13 +1,21 @@
FROM ubuntu:18.04
MAINTAINER "Chebrolu Harika <bala-sai-harika.chebrolu@hpe.com>"
WORKDIR /root
RUN apt-get update && \
RUN apt-get update -y && \
apt-get install -y --no-install-recommends --no-upgrade && \
apt-get install -y curl vim wget openssl bash ca-certificates git && \
apt-get install -y ruby-dev && \
apt-get install -y gcc make
RUN gem install oneview
ADD . oneview/
WORKDIR /root/oneview/oneview-sdk-ruby
WORKDIR /root/oneview
RUN gem install bundler
RUN bundle update

# Clean and remove not required packages
RUN DEBIAN_FRONTEND=noninteractive \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/cache/apt/archives/* /var/cache/apt/lists/* /tmp/* /root/cache/.

CMD ["/bin/bash"]
32 changes: 15 additions & 17 deletions examples/README.md
Expand Up @@ -25,34 +25,32 @@ All you need is Docker and git (optional).

1. Clone this repo and cd into it:
```bash
$ git clone https://github.com/HewlettPackard/oneview-sdk-ruby.git
$ git clone https://github.com/HewlettPackard/oneview-sdk-ruby
$ cd oneview-sdk-ruby
```

Note: You can navigate to the repo url and download the repo as a zip file if you don't want to use git

2. Build the docker image: `$ docker build -t oneview-ruby .`
2. `cd` into this examples directory, then copy the `_client.rb.example` file to a new file named `_client.rb`.

Note: If you're behind a proxy, please edit the Dockerfile before building, uncommenting/adding the necessary ENV directives for your environment.

3. Create volume in Docker to mount: `$ docker volume create oneview-ruby-volume .`
3. Modify it by inserting your credentials or authentication token, ssl_enabled flag, and anything else your environment requires. The options are commented in the `_client.rb.example` file;

4. `cd` into this examples directory, then copy the `_client.rb.example` file to a new file named `_client.rb`.
4. Build the docker image: `$ docker build -t oneview-ruby .`

5. Modify it by inserting your credentials or authentication token, ssl_enabled flag, and anything else your environment requires. The options are commented in the `_client.rb.example` file;
Note: If you're behind a proxy, please edit the Dockerfile before building, uncommenting/adding the necessary ENV directives for your environment.

6. Now you can run any of the examples in this directory:
5. Now you can run any of the examples in this directory:
```bash
# Replace "connection_template" with the name of the recipe you'd like to run.
# Replace "fc_network" with the name of the recipe you'd like to run.
# Replace "pwd" with the path of the example file you'd like to run.
$ docker run -it \
-v $(pwd)/:/ oneview-ruby-volume
oneview-ruby ruby shared_samples/fc_network.rb
$ docker run -it --rm \
-v $(pwd)/:/root/oneview
oneview-ruby ruby examples/shared_samples/fc_network.rb
```

### To run ImageStreamer examples in docker:

Follow steps from 1 to 3 as mentioned above, folllowed by steps mentioned below.
Follow step1 as mentioned above, folllowed by steps mentioned below.
1. `cd` into this examples directory, then copy the `_client_i3s.rb.example` file to a new file named `_client_i3s.rb`.

2. Modify it by inserting your authentication token, ssl_enabled flag, and anything else your environment requires. The options are commented in the `_client_i3s.rb.example` file.
Expand All @@ -61,12 +59,12 @@ Follow steps from 1 to 3 as mentioned above, folllowed by steps mentioned below.
```bash
# (Replace "plan_script" with the name of the example you'd like to run)
# (Replace "pwd" with the path of the example file you'd like to run)
$ docker run -it \
-v $(pwd)/:/ oneview-ruby-volume
oneview-ruby ruby image-streamer/api300/plan_script.rb
$ docker run -it --rm \
-v $(pwd)/:/root/oneview
oneview-ruby ruby examples/image-streamer/api300/plan_script.rb
```

That's it! If you'd like to modify a recipe, simply modify the recipe file (on the host), then re-build the image and run it.
That's it! If you'd like to modify an example, simply modify the file (on the host), then re-run the image and run your samples.

## Concurrent Execution

Expand Down

0 comments on commit b1832f4

Please sign in to comment.