-
Notifications
You must be signed in to change notification settings - Fork 78
feat: Adding Docker support #67
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM store/oracle/serverjre:8 | ||
|
||
ENV OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json" | ||
|
||
RUN yum install -y git | ||
|
||
WORKDIR /root | ||
|
||
# install Prism | ||
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh | ||
RUN chmod +x ./install.sh && sync && \ | ||
./install.sh && \ | ||
rm ./install.sh | ||
|
||
# set up default sendgrid env | ||
WORKDIR /root/sources | ||
RUN git clone https://github.com/sendgrid/java-http-client.git | ||
|
||
WORKDIR /root | ||
RUN ln -s /root/sources/java-http-client/sendgrid | ||
|
||
COPY entrypoint.sh entrypoint.sh | ||
RUN chmod +x entrypoint.sh | ||
|
||
# Set entrypoint | ||
ENTRYPOINT ["./entrypoint.sh"] | ||
CMD ["--mock"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Supported tags and respective `Dockerfile` links | ||
- `v1.0.0`, `latest` [(Dockerfile)](https://github.com/sendgrid/java-http-client/blob/master/docker/Dockerfile) | ||
|
||
# Quick reference | ||
Due to Oracle's JDK license, you must build this Docker image using the official Oracle image located in the Docker Store. You will need a Docker store account. Once you have an account, you must accept the Oracle license [here](https://store.docker.com/images/oracle-serverjre-8). On the command line, type `docker login` and provide your credentials. You may then build the image using this command `docker build -t sendgrid/java-http-client -f Dockerfile .` | ||
|
||
- **Where to get help:** | ||
[Contact SendGrid Support](https://support.sendgrid.com/hc/en-us) | ||
|
||
- **Where to file issues:** | ||
https://github.com/sendgrid/java-http-client/issues | ||
|
||
- **Where to get more info:** | ||
[USAGE.md](https://github.com/sendgrid/java-http-client/blob/master/docker/USAGE.md) | ||
|
||
- **Maintained by:** | ||
[SendGrid Inc.](https://sendgrid.com) | ||
|
||
# Usage examples | ||
- Most recent version: `docker run -it sendgrid/java-http-client`. | ||
- Your own fork: | ||
```sh-session | ||
$ git clone https://github.com/you/cool-java-http-client.git | ||
$ realpath cool-java-http-client | ||
/path/to/cool-java-http-client | ||
$ docker run -it -v /path/to/cool-java-http-client:/mnt/java-http-client sendgrid/java-http-client | ||
``` | ||
|
||
For more detailed information, see [USAGE.md](https://github.com/sendgrid/java-http-client/blob/master/docker/USAGE.md). | ||
|
||
# About | ||
|
||
java-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). | ||
|
||
java-http-client is maintained and funded by SendGrid, Inc. The names and logos for java-http-client are trademarks of SendGrid, Inc. | ||
|
||
 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
You can use Docker to easily try out or test java-http-client. | ||
|
||
<a name="Quickstart"></a> | ||
# Quickstart | ||
|
||
1. Install Docker on your machine. | ||
2. If you have not done so, create a Docker Store account [here](https://store.docker.com/signup?next=%2F) | ||
3. Navigate [here](https://store.docker.com/images/oracle-serverjre-8) and click the "Proceed to Checkout" link (don't worry, it's free). | ||
4. On the command line, execute `docker login` and provide your credentials. | ||
5. Build the Docker image using the command `docker build -t sendgrid/java-http-client -f Dockerfile .` | ||
6. Run `docker run -it sendgrid/java-http-client`. | ||
|
||
<a name="Info"></a> | ||
# Info | ||
|
||
This Docker image contains | ||
- `java-http-client` | ||
- Stoplight's Prism, which lets you try out the API without actually sending email | ||
|
||
Run it in interactive mode with `-it`. | ||
|
||
You can mount repositories in the `/mnt/java-http-client` and `/mnt/java-http-client` directories to use them instead of the default SendGrid libraries. Read on for more info. | ||
|
||
<a name="Testing"></a> | ||
# Testing | ||
Testing is easy! Run the container, `cd sendgrid`, and run `./gradlew test`. | ||
|
||
<a name="about"></a> | ||
# About | ||
|
||
java-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). | ||
|
||
java-http-client is maintained and funded by SendGrid, Inc. The names and logos for java-http-client are trademarks of SendGrid, Inc. | ||
|
||
 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#! /bin/bash | ||
clear | ||
|
||
# check for + link mounted libraries: | ||
if [ -d /mnt/java-http-client ] | ||
then | ||
rm /root/sendgrid | ||
ln -s /mnt/java-http-client/sendgrid | ||
echo "Linked mounted java-http-client's code to /root/sendgrid" | ||
fi | ||
|
||
SENDGRID_JAVA_VERSION="1.0.0" | ||
echo "Welcome to java-http-client docker v${SENDGRID_JAVA_VERSION}." | ||
echo | ||
|
||
if [ "$1" != "--no-mock" ] | ||
then | ||
echo "Starting Prism in mock mode. Calls made to Prism will not actually send emails." | ||
echo "Disable this by running this container with --no-mock." | ||
prism run --mock --spec $OAI_SPEC_URL 2> /dev/null & | ||
else | ||
echo "Starting Prism in live (--no-mock) mode. Calls made to Prism will send emails." | ||
prism run --spec $OAI_SPEC_URL 2> /dev/null & | ||
fi | ||
echo "To use Prism, make API calls to localhost:4010. For example," | ||
echo " sg = sendgrid.SendGridAPIClient(" | ||
echo " host='http://localhost:4010/'," | ||
echo " api_key=os.environ.get('SENDGRID_API_KEY_CAMPAIGNS'))" | ||
echo "To stop Prism, run \"kill $!\" from the shell." | ||
|
||
bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this file is in the "docker" directory (this is awesome btw)
can you please make a change to src/test/TestRequiredFilesExist.java to fix the file path for the DockerFile?
line 10 should look like this: