Skip to content

Commit f15d0f6

Browse files
authored
Merge pull request #43 from Dwolla/DEV-1068
DEV-1068: Dockerize dwolla-v2-csharp
2 parents 03a88f1 + fac3566 commit f15d0f6

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0
2+
3+
# Allow application key and secret to get passed in as build arguments.
4+
# If you don't want to include your API key and secret with each build,
5+
# you can also set their value statically below, meaning that their values
6+
# won't need to be supplied when a new image is built in the future.
7+
ARG app_key=YOUR_APP_KEY
8+
ARG app_secret=YOUR_APP_SECRET
9+
10+
# Set environment variables for ExampleApp, based on the build arguments.
11+
ENV DWOLLA_APP_KEY=$app_key
12+
ENV DWOLLA_APP_SECRET=$app_secret
13+
14+
RUN mkdir app app/Dwolla.Client app/ExampleApp
15+
ADD Dwolla.Client /app/Dwolla.Client
16+
ADD ExampleApp /app/ExampleApp
17+
18+
WORKDIR /app/ExampleApp
19+
20+
CMD [ "dotnet", "run" ]

README.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ request can be made using this SDK when executed within a server-side environmen
1717
- [POST](#post)
1818
- [DELETE](#delete)
1919
- [Example App](#example-app)
20+
- [Docker](#docker)
2021
- [Changelog](#changelog)
2122
- [Community](#community)
2223
- [Additional Resources](#additional-resources)
@@ -138,10 +139,38 @@ client.DeleteAsync<object>(url, null);
138139
### Example App
139140

140141
Take a look at the
141-
[Example Application](https://github.com/Dwolla/dwolla-v2-csharp/tree/master/ExampleApp) for
142+
[Example Application](https://github.com/Dwolla/dwolla-v2-csharp/tree/main/ExampleApp) for
142143
examples on how to use the available C# models to call the Dwolla API. Before you can begin using the app, however, you will need to specify a `DWOLLA_APP_KEY` and
143144
`DWOLLA_APP_SECRET` environment variable.
144145

146+
#### Docker
147+
148+
If you prefer to use Docker to run ExampleApp locally, a Dockerfile file is included in the root directory. You can either build the Docker image with your API key and secret (by passing the values via CLI), or you can specify the values for the `app_key` and `app_secret` build arguments in Dockerfile. Finally, you will need to build and run the Docker image. More information on this topic can be found on [Docker's website](https://docs.docker.com/build/hellobuild/), or you can find some example commands below.
149+
150+
##### Building Docker Container
151+
152+
```shell
153+
# Building container by specifying build arguments.
154+
# In this configuration, you will not need to modify Dockerfile. All of the
155+
# necessary arguments are passed via Docker's `--build-arg` option.
156+
$ docker build \
157+
--build-arg app_key=YOUR_API_KEY \
158+
--build-arg app_secret=YOUR_APP_SECRET \
159+
-t dwolla/csharp-example-app:latest .
160+
161+
# Building container without specifying build arguments.
162+
# In this configuration, you will need to specify your account API key and
163+
# secret (retrieved from Dwolla) in the Dockerfile file.
164+
$ docker build -t dwolla/csharp-example-app:latest .
165+
```
166+
167+
##### Running Container Instance
168+
169+
```shell
170+
# Running Docker container in interactive shell
171+
$ docker run --init -it dwolla/csharp-example-app:latest
172+
```
173+
145174
## Changelog
146175

147176
- **5.2.2** Update `Newtonsoft.Json` to version 13.0.1

0 commit comments

Comments
 (0)