Skip to content

Commit f0246f2

Browse files
committed
Update Dockerfile for local development
1 parent fffd3b7 commit f0246f2

File tree

4 files changed

+17
-152
lines changed

4 files changed

+17
-152
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ehthumbs.db
66
# HUGO
77
/public
88
/resources
9+
.hugo_build.lock
910

1011
# Generated client pages
1112
content/download/*.md

Dockerfile

Lines changed: 9 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,15 @@
1-
FROM alpine:latest
2-
MAINTAINER Mathilde Ffrench <[email protected]>
3-
4-
ENV LANG=C.UTF-8 PYTHON_VERSION=2.7.12 PYTHON_PIP_VERSION=8.1.2 HUGO_VERSION=0.16 NODE_VERSION=v6.3.1 NPM_VERSION=3 NODE_CONFIG_FLAGS="--fully-static" NODE_DEL_PKGS="libgcc libstdc++" NODE_RM_DIRS=/usr/include GRMK_PKGNAME=graphicsmagick GRMK_PKGVER=1.3.23
5-
ENV GRMK_PKGSOURCE=https://downloads.sourceforge.net/$GRMK_PKGNAME/$GRMK_PKGNAME/$GRMK_PKGVER/GraphicsMagick-$GRMK_PKGVER.tar.lz
6-
7-
# nats-site dev env - one shoot installer : Python, Hugo, Pygments, GraphicsMagick and Node
8-
RUN set -ex \
9-
&& apk add --update wget ca-certificates \
10-
&& apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \
11-
&& apk add --no-cache --virtual .build-deps \
12-
bzip2-dev \
13-
gcc \
14-
libc-dev \
15-
linux-headers \
16-
make \
17-
ncurses-dev \
18-
openssl-dev \
19-
pax-utils \
20-
readline-dev \
21-
sqlite-dev \
22-
tcl-dev \
23-
tk-dev \
24-
zlib-dev \
25-
&& apk add --update g++ \
26-
gcc \
27-
make \
28-
lzip \
29-
wget \
30-
libjpeg-turbo-dev \
31-
libpng-dev \
32-
libtool \
33-
libgomp \
34-
&& apk add --no-cache curl make gcc g++ linux-headers paxctl libgcc libstdc++ gnupg \
35-
36-
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
37-
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
38-
&& export GNUPGHOME="$(mktemp -d)" \
39-
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
40-
C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF \
41-
9554F04D7259F04124DE6B476D5A82AC7E37093B \
42-
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
43-
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
44-
FD3A5288F042B6850C66B31F09FE44734EB7990E \
45-
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
46-
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
47-
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
48-
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
49-
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
50-
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
51-
52-
&& mkdir -p /usr/src/python \
53-
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
54-
&& rm python.tar.xz \
55-
&& cd /usr/src/python \
56-
&& ./configure \
57-
--enable-shared \
58-
--enable-unicode=ucs4 \
59-
&& make -j$(getconf _NPROCESSORS_ONLN) \
60-
&& make install \
61-
62-
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
63-
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
64-
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
65-
&& find /usr/local -depth \
66-
\( \
67-
\( -type d -a -name test -o -name tests \) \
68-
-o \
69-
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
70-
\) -exec rm -rf '{}' + \
71-
&& runDeps="$( \
72-
scanelf --needed --nobanner --recursive /usr/local \
73-
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
74-
| sort -u \
75-
| xargs -r apk info --installed \
76-
| sort -u \
77-
)" \
78-
&& apk add --virtual .python-rundeps $runDeps \
79-
80-
&& cd /tmp/ \
81-
&& wget --no-check-certificate https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-64bit.tgz \
82-
&& tar xzf hugo_${HUGO_VERSION}_linux-64bit.tgz \
83-
&& rm -r hugo_${HUGO_VERSION}_linux-64bit.tgz \
84-
&& mv hugo /usr/bin/hugo \
85-
86-
&& cd / \
87-
&& pip install Pygments \
88-
89-
&& wget $GRMK_PKGSOURCE \
90-
&& lzip -d -c GraphicsMagick-$GRMK_PKGVER.tar.lz | tar -xvf - \
91-
&& cd GraphicsMagick-$GRMK_PKGVER \
92-
&& ./configure \
93-
--build=$CBUILD \
94-
--host=$CHOST \
95-
--prefix=/usr \
96-
--sysconfdir=/etc \
97-
--mandir=/usr/share/man \
98-
--infodir=/usr/share/info \
99-
--localstatedir=/var \
100-
--enable-shared \
101-
--disable-static \
102-
--with-modules \
103-
--with-threads \
104-
--with-gs-font-dir=/usr/share/fonts/Type1 \
105-
--with-quantum-depth=16 \
106-
&& make \
107-
&& make install \
108-
&& cd .. \
109-
&& rm -rf GraphicsMagick-$GRMK_PKGVER \
110-
&& rm GraphicsMagick-$GRMK_PKGVER.tar.lz \
111-
112-
&& curl -o node-${NODE_VERSION}.tar.gz -sSL https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.gz \
113-
&& curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc \
114-
&& export GNUPGHOME="$(mktemp -d)" \
115-
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
116-
C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF \
117-
9554F04D7259F04124DE6B476D5A82AC7E37093B \
118-
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
119-
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
120-
FD3A5288F042B6850C66B31F09FE44734EB7990E \
121-
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
122-
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
123-
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
124-
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
125-
&& gpg --verify SHASUMS256.txt.asc \
126-
&& grep node-${NODE_VERSION}.tar.gz SHASUMS256.txt.asc | sha256sum -c - \
127-
&& tar -zxf node-${NODE_VERSION}.tar.gz \
128-
&& cd node-${NODE_VERSION} \
129-
&& export GYP_DEFINES="linux_use_gold_flags=0" \
130-
&& ./configure --prefix=/usr ${NODE_CONFIG_FLAGS} \
131-
&& NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
132-
&& make -j${NPROC} -C out mksnapshot BUILDTYPE=Release \
133-
&& paxctl -cm out/Release/mksnapshot \
134-
&& make -j${NPROC} \
135-
&& make install \
136-
&& paxctl -cm /usr/bin/node \
137-
&& cd / \
138-
&& if [ -x /usr/bin/npm ]; then \
139-
npm install -g npm@${NPM_VERSION} && \
140-
find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf; \
141-
fi \
142-
&& apk del curl make gcc g++ python linux-headers paxctl gnupg ${NODE_DEL_PKGS} \
143-
&& rm -rf /etc/ssl /node-${VERSION}.tar.gz /SHASUMS256.txt.asc /node-${NODE_VERSION} ${NODE_RM_DIRS} \
144-
/usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp /root/.gnupg \
145-
/usr/lib/node_modules/npm/man /usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html \
146-
&& apk del wget ca-certificates
1+
FROM node:current-alpine
1472

3+
RUN apk add --update hugo
1484

1495
VOLUME /nats-site
150-
1516
WORKDIR /nats-site
1527

153-
EXPOSE 1313
8+
COPY package.json /nats-site/package.json
9+
COPY package-lock.json /nats-site/package-lock.json
10+
COPY yarn.lock /nats-site/yarn.lock
11+
RUN npm install
15412

155-
CMD ["/usr/bin/hugo", "server", "-w", "--bind", "0.0.0.0"]
13+
EXPOSE 1313
14+
ENTRYPOINT [""]
15+
CMD ["/usr/bin/hugo", "server", "-D", "-w", "--bind", "0.0.0.0"]

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ netlify-production-build: generate-client-pages
1313

1414
netlify-preview-build: generate-client-pages
1515
hugo --baseURL $(DEPLOY_PRIME_URL) --buildDrafts --buildFuture
16+
17+
docker:
18+
@echo "\033[0;32m Building and running NATS Website ... \033[0m"
19+
docker build -t nats-site .
20+
docker run --rm -p 1313:1313 -v ${PWD}:/nats-site nats-site

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ If you are a production end user of NATS and would like your company logo displa
173173

174174
## Local Development
175175

176-
You can either use docker image for your local development or install requirements following this documentation.
177-
176+
You can either user docker image for your local development via `make docker` or install requirements following this documentation.
178177

179178
Clone your forked copy of the repository:
180179
```
@@ -195,7 +194,7 @@ Install [Hugo](https://gohugo.io/), [npm](https://docs.npmjs.com/getting-started
195194

196195
#### Building the Site
197196

198-
See the makefile for run commands.
197+
See the [Makefile](./Makefile) for other commands.
199198

200199

201200
Thank you for your interest in NATS!

0 commit comments

Comments
 (0)