Skip to content

Commit 6d24bc4

Browse files
committed
feat: build and run from Docker Support
Build and run the generator from docker image support added. The main aim and motivation behind doing this is, because of a no. of different jhipster blueprints are there, which are compatible and works with the different version of jhipster and also might be incompatible with other blueprints or versions of jhipster. Signed-off-by: Pratik Raj <[email protected]>
1 parent 052e0d5 commit 6d24bc4

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:20.04
2+
RUN \
3+
# configure the "jhipster" user
4+
groupadd jhipster && \
5+
useradd jhipster -s /bin/bash -m -g jhipster -G sudo && \
6+
echo 'jhipster:jhipster' |chpasswd && \
7+
mkdir /home/jhipster/app && \
8+
export DEBIAN_FRONTEND=noninteractive && \
9+
export TZ=Europe\Paris && \
10+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
11+
apt-get update && \
12+
# install utilities
13+
apt-get install -y \
14+
wget \
15+
sudo && \
16+
# install node.js
17+
wget https://nodejs.org/dist/v12.18.4/node-v12.18.4-linux-x64.tar.gz -O /tmp/node.tar.gz && \
18+
tar -C /usr/local --strip-components 1 -xzf /tmp/node.tar.gz && \
19+
# upgrade npm
20+
npm install -g npm && \
21+
# install yeoman
22+
npm install -g yo && \
23+
# cleanup
24+
apt-get clean && \
25+
rm -rf \
26+
/home/jhipster/.cache/ \
27+
/var/lib/apt/lists/* \
28+
/tmp/* \
29+
/var/tmp/*
30+
31+
# install jhipster
32+
RUN npm install -g [email protected]
33+
34+
RUN \
35+
# install the blueprint
36+
npm install -g generator-jhipster-primeng-blueprint && \
37+
# fix jhipster user permissions
38+
chown -R jhipster:jhipster \
39+
/home/jhipster \
40+
/usr/local/lib/node_modules && \
41+
# cleanup
42+
rm -rf \
43+
/home/jhipster/.cache/ \
44+
/var/lib/apt/lists/* \
45+
/tmp/* \
46+
/var/tmp/*
47+
48+
# expose the working directory
49+
USER jhipster
50+
ENV PATH $PATH:/usr/bin
51+
WORKDIR "/home/jhipster/app"
52+
VOLUME ["/home/jhipster/app"]
53+
CMD ["jhipster", "--blueprints", "primeng-blueprint"]

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,40 @@ To use this blueprint, run the below command
5959
jhipster --blueprint primeng-blueprint
6060
```
6161

62+
## Using Docker
63+
64+
Download the Dockerfile:
65+
66+
```bash
67+
mkdir docker
68+
cd docker
69+
wget https://github.com/elhoutico/jhipster-primeng-blueprint/raw/master/Dockerfile
70+
```
71+
72+
Build the Docker images:
73+
74+
```bash
75+
docker build -t jhipster-primeng-blueprint:latest .
76+
```
77+
78+
Make a folder where you want to generate the Service:
79+
80+
```bash
81+
mkdir service
82+
cd service
83+
```
84+
85+
Run the generator from image to generate service:
86+
87+
```bash
88+
docker run -it --rm -v $PWD:/home/jhipster/app jhipster-primeng-blueprint
89+
```
90+
91+
Run and attach interactive shell to the generator docker container to work from inside the running container:
92+
93+
```bash
94+
docker run -it --rm -v $PWD:/home/jhipster/app jhipster-primeng-blueprint /bin/bash
95+
```
6296

6397
## Running local Blueprint version for development
6498

0 commit comments

Comments
 (0)