Skip to content

Commit 6725a4d

Browse files
committed
[Issue #425] Dockerize resin docs
1 parent cc27812 commit 6725a4d

File tree

5 files changed

+67
-6
lines changed

5 files changed

+67
-6
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
node_modules
3+
.DS_Store
4+
*.swp
5+
*.swo
6+
tmp

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ npm-debug.log
1010
.DS_Store
1111
*.swp
1212
*.swo
13+
tmp

Dockerfile

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
FROM library/node:6.3
22

3-
EXPOSE 3000
3+
RUN mkdir /src
4+
WORKDIR /src
45

5-
WORKDIR /usr/src/app
6+
COPY package.json .
7+
RUN npm install
68

79
COPY . .
10+
RUN node_modules/bower/bin/bower --allow-root install \
11+
&& tools/prepare.sh
812

9-
# npm install needs to run after the COPY because of postinstall deps.
10-
RUN npm install --unsafe-perm --allow-root \
11-
&& npm cache clean \
12-
&& node_modules/bower/bin/bower --allow-root cache clean
13+
EXPOSE 3000
1314

1415
ENTRYPOINT ["/usr/local/bin/npm"]
1516
CMD ["start"]
17+

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
IMAGE=resin/docs
2+
3+
all: build
4+
5+
build:
6+
docker build -t ${IMAGE}:latest .
7+
8+
run: build
9+
docker run -it --rm \
10+
-p 3000:3000 \
11+
${IMAGE}:latest
12+
13+
shell: build
14+
docker run -it --rm
15+
--entrypoint /bin/bash
16+
${IMAGE}:latest
17+
18+
test: build
19+

circle.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
machine:
3+
services:
4+
- docker
5+
environment:
6+
DOCKER_USERNAME: travisciresin
7+
DOCKER_EMAIL: [email protected]
8+
DOCKER_IMAGE: resin/docs
9+
dependencies:
10+
override:
11+
- docker info
12+
- env | sort
13+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" -e="${DOCKER_EMAIL}"
14+
compile:
15+
override:
16+
- docker pull ${DOCKER_IMAGE}:latest || true
17+
- docker build --rm=false --pull --tag ${DOCKER_IMAGE}:${CIRCLE_SHA1} .
18+
test:
19+
override:
20+
- echo true
21+
deployment:
22+
hub:
23+
branch: /.*/
24+
commands:
25+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" -e="${DOCKER_EMAIL}"
26+
- docker push ${DOCKER_IMAGE}:${CIRCLE_SHA1}
27+
- docker tag ${DOCKER_IMAGE}:${CIRCLE_SHA1} ${DOCKER_IMAGE}:${CIRCLE_BRANCH}
28+
- docker push ${DOCKER_IMAGE}:${CIRCLE_BRANCH}
29+
- docker tag -f ${DOCKER_IMAGE}:${CIRCLE_SHA1} ${DOCKER_IMAGE}:latest
30+
- docker push ${DOCKER_IMAGE}:latest
31+
- "[[ -z ${CIRCLE_TAG} ]] || docker tag ${DOCKER_IMAGE}:${CIRCLE_SHA1} ${DOCKER_IMAGE}:${CIRCLE_TAG}"
32+
- "[[ -z ${CIRCLE_TAG} ]] || docker push ${DOCKER_IMAGE}:${CIRCLE_TAG}"
33+

0 commit comments

Comments
 (0)