Skip to content

Commit

Permalink
docker: Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
gokaygurcan committed Apr 26, 2019
1 parent 710076c commit bfbde74
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# gokaygurcan/dockerfile-node

root = true

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

[Dockerfile]
indent_size = 4
40 changes: 17 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,51 @@
FROM gokaygurcan/ubuntu:latest

# metadata
LABEL maintainer = "Gökay Gürcan <[email protected]>"
LABEL com.gokaygurcan.project.name = "dockerfile-node"
LABEL com.gokaygurcan.project.version = "1.2.2"
LABEL org.label-schema.name = "dockerfile-node"
LABEL org.label-schema.description = "Node.js with npm, Yarn and N|Solid."
LABEL org.label-schema.vcs-url = "https://github.com/gokaygurcan/dockerfile-node"
LABEL org.label-schema.vendor = "gokaygurcan"
LABEL org.label-schema.version = "1.2.2"
LABEL org.label-schema.schema-version = "1.0"
LABEL maintainer "Gökay Gürcan <[email protected]>"

ENV DEBIAN_FRONTEND="noninteractive" \
USR_SRC_NODE=/usr/src/node \
NS_NODE=node_10.x \
NS_NSOLID=nsolid_3.x \
NS_DISTRO=bionic

USER root

RUN mkdir -p ${USR_SRC_NODE}

WORKDIR ${USR_SRC_NODE}
RUN curl -sLf -o /dev/null "https://deb.nodesource.com/${NS_NODE}/dists/${NS_DISTRO}/Release" && \
RUN mkdir -p /usr/src/node && \
cd /usr/src/node && \
# install node
curl -sLf -o /dev/null "https://deb.nodesource.com/${NS_NODE}/dists/${NS_DISTRO}/Release" && \
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb https://deb.nodesource.com/${NS_NODE} ${NS_DISTRO} main" | tee /etc/apt/sources.list.d/nodesource-node.list && \
echo "deb-src https://deb.nodesource.com/${NS_NODE} ${NS_DISTRO} main" | tee -a /etc/apt/sources.list.d/nodesource-node.list && \
echo "deb https://deb.nodesource.com/${NS_NODE} ${NS_DISTRO} main" | tee /etc/apt/sources.list.d/nsolid.list && \
echo "deb-src https://deb.nodesource.com/${NS_NODE} ${NS_DISTRO} main" | tee -a /etc/apt/sources.list.d/nsolid.list && \
apt-get update -qq && \
apt-get install -yqq nodejs && \
# configure npm
npm config list > /dev/null 2>&1 && \
mkdir -p /home/ubuntu/.config && \
chown -R ubuntu:$(id -gn ubuntu) /home/ubuntu/.config && \
mkdir -p /home/ubuntu/.npm-global && \
chown -R ubuntu:$(id -gn ubuntu) /home/ubuntu/.npm-global && \
npm config --global set prefix /home/ubuntu/.npm-global && \
# install yarn
curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -qq && \
apt-get install -y yarn && \
# install nsolid
curl -sLf -o /dev/null "http://nsolid-deb.nodesource.com/${NS_NSOLID}/dists/${NS_DISTRO}/Release" && \
curl -s http://nsolid-deb.nodesource.com/gpgkey/NODESOURCE-NSOLID-GPG-SIGNING-KEY | apt-key add - && \
echo "deb http://nsolid-deb.nodesource.com/${NS_NSOLID} ${NS_DISTRO} main" | tee /etc/apt/sources.list.d/nodesource-nsolid.list && \
echo "deb-src http://nsolid-deb.nodesource.com/${NS_NSOLID} ${NS_DISTRO} main" | tee -a /etc/apt/sources.list.d/nodesource-nsolid.list && \
echo "deb http://nsolid-deb.nodesource.com/${NS_NSOLID} ${NS_DISTRO} main" | tee /etc/apt/sources.list.d/nsolid.list && \
apt-get update -qq && \
apt-get install -yqq nsolid-dubnium && \
# cleanup
apt-get autoclean -yqq && \
apt-get autoremove -yqq && \
rm -rf ${USR_SRC_NODE} && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*
rm -rf /usr/src/* && \
rm -rf /var/lib/{apt,dpkg,cache,log}/ && \
rm -rf /var/tmp/* && \
rm -rf /tmp/*

WORKDIR /usr/bin
WORKDIR /home/ubuntu

USER ubuntu

Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@

<h2>Environment variables</h2>

| Name | Value |
| Variable | Value |
| ------------ | ------------- |
| USR_SRC_NODE | /usr/src/node |
| NS_NODE | node_10.x |
| NS_NSOLID | nsolid_3.x |
| NS_DISTRO | bionic |

<h2>Additional packages</h2>

- lsb-release

<h2>CMD</h2>

```bash
Expand All @@ -27,10 +22,12 @@ To pull the image

```bash
docker pull gokaygurcan/node:latest
```

# or
And then,

docker pull gokaygurcan/node:dubnium
```bash
docker run gokaygurcan/node:latest node -e "console.log(process.versions);"
```

---
Expand Down

0 comments on commit bfbde74

Please sign in to comment.