Skip to content

Commit 1976cba

Browse files
committed
MOBILE-2837 Docker: Add a Dockerfile for easier testing and CI
1 parent b7d56bf commit 1976cba

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
Dockerfile

Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This image is based on the fat node 11 image.
2+
# We require fat images as neither alpine, or slim, include git binaries.
3+
FROM node:11
4+
5+
# Port 8100 for ionic dev server.
6+
EXPOSE 8100
7+
8+
# Port 35729 is the live-reload server.
9+
EXPOSE 35729
10+
11+
# Port 53703 is the Chrome dev logger port.
12+
EXPOSE 53703
13+
14+
# MoodleMobile uses Cordova, Ionic, and Gulp.
15+
RUN npm install -g cordova ionic gulp && rm -rf /root/.npm
16+
17+
WORKDIR /app
18+
19+
COPY . /app
20+
21+
# The setup script will handle npm installation, cordova setup, and gulp setup.
22+
RUN npm run setup && rm -rf /root/.npm
23+
24+
# Provide a Healthcheck command for easier use in CI.
25+
HEALTHCHECK --interval=10s --timeout=3s --start-period=30s CMD curl -f http://localhost:8100 || exit 1
26+
27+
CMD ["ionic", "serve", "-b"]

hooks/post_push

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ "integration" != "${SOURCE_BRANCH}" ]
6+
then
7+
# A space-separated list of additional tags to place on this image.
8+
additionalTags=(latest)
9+
10+
# Tag and push image for each additional tag
11+
for tag in ${additionalTags[@]}; do
12+
echo "Tagging {$IMAGE_NAME} as ${DOCKER_REPO}:${tag}"
13+
docker tag $IMAGE_NAME ${DOCKER_REPO}:${tag}
14+
15+
echo "Pushing ${DOCKER_REPO}:${tag}"
16+
docker push ${DOCKER_REPO}:${tag}
17+
done
18+
fi

0 commit comments

Comments
 (0)