forked from spring-petclinic/spring-petclinic-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request spring-petclinic#41 from antechrestos/features/add…
…-dockerfile Add dockerfile to build application in a docker nginx image
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
node_modules |
This file contains 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,32 @@ | ||
ARG DOCKER_HUB="docker.io" | ||
|
||
FROM $DOCKER_HUB/library/node:10.10-alpine as build | ||
|
||
|
||
COPY . /workspace/ | ||
|
||
ARG NPM_REGISTRY=" https://registry.npmjs.org" | ||
|
||
RUN echo "registry = \"$NPM_REGISTRY\"" > /workspace/.npmrc && \ | ||
cd /workspace/ && \ | ||
npm install && \ | ||
npm run build | ||
|
||
ARG NGINX_VERSION="1.17.6" | ||
FROM $DOCKER_HUB/library/nginx:$NGINX_VERSION AS runtime | ||
|
||
|
||
COPY --from=build /workspace/dist/ /usr/share/nginx/html/ | ||
|
||
RUN chmod a+rwx /var/cache/nginx /var/run /var/log/nginx && \ | ||
sed -i.bak 's/listen\(.*\)80;/listen 8080;/' /etc/nginx/conf.d/default.conf && \ | ||
sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf | ||
|
||
|
||
EXPOSE 8080 | ||
|
||
USER nginx | ||
|
||
HEALTHCHECK CMD [ "service", "nginx", "status" ] | ||
|
||
|
This file contains 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