Skip to content

Commit

Permalink
chore(docker): first release
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Jun 19, 2018
0 parents commit bb6bc8a
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sudo: required

services:
- docker

env:
matrix:
- env:
VERSION: '10.4.1'
- env:
VERSION: '9.11.2'
- env:
VERSION: '8.11.3'
- env:
VERSION: '6.14.3'

install:
- docker build -t "lgatica/node-onbuild:$VERSION" "$VERSION"

script:
- docker run --rm "lgatica/node-onbuild:$VERSION" node --version

notifications:
email: false
18 changes: 18 additions & 0 deletions 10.4.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:10.4.1-alpine@sha256:0a6a9171522c8ef27f0bf0a2932a81f57c48889ba6091c55f43e9e6593e15598

LABEL maintainer "Leonardo Gatica <[email protected]>"

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD ARG NODE_ENV
ONBUILD ENV NODE_ENV $NODE_ENV
ONBUILD COPY package.json yarn.* /usr/src/app/
ONBUILD RUN if [ -e yarn.lock ]; \
then yarn && yarn cache clean; \
else npm i && npm cache clean --force; fi && \
apk del build-dependencies && \
rm -rf ~/.node-gyp /tmp/*
ONBUILD COPY . /usr/src/app

CMD [ "node", "index.js" ]
18 changes: 18 additions & 0 deletions 6.14.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:6.14.3-alpine@sha256:184fb208d9a35a133aaa9baaf915321b523e4ebe5b53a8d138f527c833b60d1f

LABEL maintainer "Leonardo Gatica <[email protected]>"

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD ARG NODE_ENV
ONBUILD ENV NODE_ENV $NODE_ENV
ONBUILD COPY package.json yarn.* /usr/src/app/
ONBUILD RUN if [ -e yarn.lock ]; \
then yarn && yarn cache clean; \
else npm i && npm cache clean --force; fi && \
apk del build-dependencies && \
rm -rf ~/.node-gyp /tmp/*
ONBUILD COPY . /usr/src/app

CMD [ "node", "index.js" ]
18 changes: 18 additions & 0 deletions 8.11.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:8.11.3-alpine@sha256:d743b4141b02fcfb8beb68f92b4cd164f60ee457bf2d053f36785bf86de16b0d

LABEL maintainer "Leonardo Gatica <[email protected]>"

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD ARG NODE_ENV
ONBUILD ENV NODE_ENV $NODE_ENV
ONBUILD COPY package.json yarn.* /usr/src/app/
ONBUILD RUN if [ -e yarn.lock ]; \
then yarn && yarn cache clean; \
else npm i && npm cache clean --force; fi && \
apk del build-dependencies && \
rm -rf ~/.node-gyp /tmp/*
ONBUILD COPY . /usr/src/app

CMD [ "node", "index.js" ]
18 changes: 18 additions & 0 deletions 9.11.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:9.11.2-alpine@sha256:de0fc4272136f43c366f68681743b5717e2e7db7646b20c714005274cd638204

LABEL maintainer "Leonardo Gatica <[email protected]>"

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD ARG NODE_ENV
ONBUILD ENV NODE_ENV $NODE_ENV
ONBUILD COPY package.json yarn.* /usr/src/app/
ONBUILD RUN if [ -e yarn.lock ]; \
then yarn && yarn cache clean; \
else npm i && npm cache clean --force; fi && \
apk del build-dependencies && \
rm -rf ~/.node-gyp /tmp/*
ONBUILD COPY . /usr/src/app

CMD [ "node", "index.js" ]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Leonardo Gatica

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# node-onbuild

[![dockeri.co](http://dockeri.co/image/lgatica/node-onbuild)](https://hub.docker.com/r/lgatica/node-onbuild/)

[![Build Status](https://travis-ci.org/lgaticaq/node-onbuild.svg?branch=master)](https://travis-ci.org/lgaticaq/node-onbuild)

> Docker onbuild image for node apps with alpine linux
Supported tags and respective Dockerfile links

* 10.4.1, 10.4, 10, latest ([10.4/Dockerfile](https://github.com/lgaticaq/node-onbuild/blob/master/10.4.1/Dockerfile))
* 9.11.2, 9.11, 9 ([9.11/Dockerfile](https://github.com/lgaticaq/node-onbuild/blob/master/9.11.2/Dockerfile))
* 8.11.3, 8.11, 8 ([8.11/Dockerfile](https://github.com/lgaticaq/node-onbuild/blob/master/8.11.3/Dockerfile))
* 6.14.3, 6.14, 6 ([6.14/Dockerfile](https://github.com/lgaticaq/node-onbuild/blob/master/6.14.3/Dockerfile))

## Create a Dockerfile in your Node.js app project

```dockerfile
FROM lgatica/node-onbuild:10.4.1
EXPOSE 3000
```

You can then build and run the Docker image:

```bash
docker build -t my-nodejs-app .
docker run -it --rm --name my-running-app my-nodejs-app
```

### Notes

The image assumes that your application has a file named package.json listing its dependencies and defining its start script.
3 changes: 3 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["config:base", ":docker"]
}

0 comments on commit bb6bc8a

Please sign in to comment.