Skip to content

Commit 3e70534

Browse files
authored
Merge pull request #103 from DMTF/Docker-File
Added Dockerfile to allow the emulator to run as a Docker container
2 parents 8cf92f2 + 4b73cca commit 3e70534

3 files changed

Lines changed: 92 additions & 4 deletions

File tree

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3-slim
2+
3+
# For healthcheck
4+
RUN apt-get update && apt-get install curl -y
5+
6+
# Install python requirements
7+
COPY requirements.txt /tmp/
8+
RUN pip install --upgrade pip && \
9+
pip install --no-cache-dir -r /tmp/requirements.txt
10+
11+
# Copy server files
12+
COPY . /usr/src/app/.
13+
14+
# Env settings
15+
EXPOSE 5000
16+
HEALTHCHECK CMD curl --fail http://127.0.0.1:5000/redfish/v1/ || exit 1
17+
WORKDIR /usr/src/app
18+
ENTRYPOINT ["python", "emulator.py"]

README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,30 @@ The 'pip' command can be used to install the environment.
2929
The 'pip freeze' command can be used to display the installed packages and their revision.
3030

3131
### Cloud
32+
3233
The required python packages for a Cloud Foundry environment are listed in the file **./requirements.txt**. The file lists the Python package, without the revision.
3334
The packages will be installed automatically during invocation.
3435

36+
### Docker
37+
38+
Use one of these actions to pull or build the container:
39+
40+
* Pull the container from Docker Hub:
41+
42+
```bash
43+
docker pull dmtf/redfish-interface-emulator:latest
44+
```
45+
* Build a container from local source:
46+
47+
```bash
48+
docker build -t dmtf/redfish-interface-emulator:latest.
49+
```
50+
* Build a container from GitHub:
51+
52+
```bash
53+
docker build -t dmtf/redfish-interface-emulator:latest https://github.com/DMTF/Redfish-Interface-Emulator.git
54+
```
55+
3556
## Invocation
3657

3758
### Standalone
@@ -50,6 +71,14 @@ The **foundry-app-name** determines the URL for the Redfish service.
5071

5172
The cloud foundry makes use of the following files: requirements.txt, runtime.txt, and Profile. So they should exists in the same directory as emulator.py.
5273

74+
### Docker
75+
76+
This command runs the container with the built-in mockup:
77+
78+
```bash
79+
docker run --rm dmtf/redfish-interface-emulator:latest
80+
```
81+
5382
## Configuring the Emulator
5483
The behavior of the emulator can be control via command line flags or property values in emulator-config.json.
5584

@@ -272,7 +301,10 @@ To use, point a brower to the URI **http://localhost:5000/browse.html**
272301
273302
## Release Process
274303
275-
1. Update `CHANGELOG.md` with the list of changes since the last release
276-
2. Update the `__version__` variable in `api_emulator/version.py` to reflect the new tool version
277-
3. Push changes to Github
278-
4. Create a new release in Github
304+
Run the `release.sh` script to publish a new version.
305+
306+
```bash
307+
sh release.sh <NewVersion>
308+
```
309+
310+
Enter the release notes when prompted; an empty line signifies no more notes to add.

release.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Collect change log info
4+
CHANGES="## [$1] - $(date +'%Y-%m-%d')"$'\n'
5+
echo "Enter changes:"
6+
while : ; do
7+
read CHANGE
8+
if [ "$CHANGE" = "" ]; then
9+
break
10+
fi
11+
12+
CHANGES="$CHANGES- $CHANGE"$'\n'
13+
done
14+
15+
# Rebase
16+
git checkout master
17+
git fetch && git rebase origin
18+
19+
# Update the version number in api_emulator/version.py
20+
sed -i -E 's/__version__ = .+/__version__ = '\'$1\''/' api_emulator/version.py
21+
22+
# Update the change log file
23+
ex CHANGELOG.md <<eof
24+
3 insert
25+
$CHANGES
26+
.
27+
xit
28+
eof
29+
30+
# Commit and push changes
31+
git add CHANGELOG.md api_emulator/version.py
32+
git commit -m "$1 versioning"
33+
git push origin master
34+
35+
# Make new release in GitHub
36+
CHANGES="Changes since last release:"$'\n\n'"$CHANGES"
37+
gh release create $1 -n "$CHANGES"
38+

0 commit comments

Comments
 (0)