generator-jhipster-docker
v2.5.0
Published
Additional Docker support: Docker Hub, Local SMTP Server, NGinx
Downloads
757
Maintainers
Readme
generator-jhipster-docker
JHipster module, additional Docker support in your JHipster application
Introduction
This is a JHipster module, that is meant to be used in a JHipster application. This module is used to generate a:
- Dockerfile for Automated build at Docker Hub
- Docker Compose file for using a Local SMTP Server with MailDev
- Docker Compose file for using NGinx as proxy server
Table of contents
Prerequisites
As this is a JHipster module, we expect you have JHipster and its related tools already installed:
You have to install Docker and Docker Compose:
To use Automated build, you have to create an account at:
Installation
With Yarn
To install this module:
yarn global add generator-jhipster-docker
To update this module:
yarn global upgrade generator-jhipster-docker
With NPM
To install this module:
npm install -g generator-jhipster-docker
To update this module:
npm update -g generator-jhipster-docker
Usage
To run the module on a JHipster generated application:
yo jhipster-docker
You can use this command to generate the Dockerfile for Automated build:
yo jhipster-docker default
To force the generator:
yo jhipster-docker default --force
1 - Automated build at the Docker Hub
1.1 - Description
When using the option Dockerfile for Automated build, Docker Hub will build a Docker image everytime you commit to your repository.
1.2 - Generate the files
- Launch :
yo jhipster-docker
- Select the option :
Dockerfile for Automated build at https://hub.docker.com/
1.3 - Set your Docker Hub project
At GitHub
- Go to Settings > Integrations & services
- Add service and select Docker
- Click [x] active
- Click on update service
- Back to Integration & services, Docker must be :white_check_mark: Docker
At Docker Hub
- Go to https://hub.docker.com/r/YOUR_DOCKER_ID/ (replace
YOUR_DOCKER_ID
by yours) - Menu Create
- Select Create Automated Build
- Select the repository of your project
- Put a description, then click on create
- Go to Build Settings
- Choose your branch or let master by default
- Put this Dockerfile location: /
- Click on Save Changes
- Return to this project: git commit and push these changes!
- Go to Build details: it should be a new line with Building
2 - Local SMTP Server
The project djfarrelly/maildev is a simple way to test your project’s generated emails during development with an easy to use web interface.
You can launch:
docker-compose -f src/main/docker/smtp.yml up -d
You can access to it: http://localhost:1080
3 - NGinx as proxy server
See the official documentation
Follow these steps:
- Start your local backend server or use an existing one. You can start more than 1 backend server.
- Edit
src/main/docker/nginx/nginx.conf
, depending on the 1st step - Start NGinx:
docker-compose -f src/main/docker/nginx.yml up -d
Note:
The use of network_mode: 'host'
in nginx.yml
may not work for Windows or MacOS.
Simply comment it and replace localhost
in src/main/docker/nginx/nginx.conf
file.
Your container (from inside) must access to the application.
You can access to it: http://localhost or http://localhost:8000
License
Apache-2.0 © Pascal Grimaud and the respective JHipster contributors