Last active
December 10, 2017 08:48
-
-
Save mastef/9e0b8f7a686c5231496561ac9993ab37 to your computer and use it in GitHub Desktop.
openfl-modular testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stop on errors | |
set -e | |
# stop and remove container if already running | |
docker ps -a -q --filter "name=openflmodtest" | grep -q . && docker stop openflmodtest && docker rm -fv openflmodtest | |
# clean up old built images that aren't tagged | |
# docker rmi $(docker images -f "dangling=true" -q) || true | |
# re-build docker container | |
docker build -t openfl/openfl_js_test . | |
# start docker container | |
docker run -d --name openflmodtest -p 8080:8080 openfl/openfl_js_test | |
# attach to logs output | |
docker logs -f openflmodtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openfl/openfl:develop | |
## install node/npm | |
ADD https://deb.nodesource.com/setup_8.x /opt/node8setup.sh | |
RUN chmod +x /opt/node8setup.sh && /opt/node8setup.sh | |
RUN apt-get install -y --no-install-recommends nodejs | |
## tests need these modules, let's have them in global namespace | |
RUN npm install http-server -g | |
RUN npm install webpack -g | |
## install hxgenjs | |
## re-install if repo changed and clear docker cache | |
ADD https://api.github.com/repos/jgranick/hxgenjs/compare/master...HEAD /dev/null | |
RUN haxelib git hxgenjs https://github.com/jgranick/hxgenjs | |
## pull repo | |
## re-install if repo changed and clear docker cache | |
ADD https://api.github.com/repos/openfl/openfl-js/compare/master...HEAD /dev/null | |
RUN git clone https://github.com/openfl/openfl-js /opt/openfl-js | |
WORKDIR /opt/openfl-js | |
RUN npm install | |
RUN npm run build -s | |
RUN npm link | |
# this is where we test, change if you want to test something else | |
WORKDIR /opt/openfl-js/samples/es6/helloworld | |
RUN npm link openfl | |
RUN npm install | |
# more logs from npm | |
ENV NPM_CONFIG_LOGLEVEL info | |
# if you're testing locally, you might want to overwrite with your local files | |
# another way would be to use a volume and share your whole local directory, | |
# but then you'd use your own node_modules directory | |
# ADD ./samples/es6/helloworld/entry.js /opt/openfl-js/samples/es6/helloworld/entry.js | |
# the local port of this local container we need to expose. | |
# not relevant to your host machine port - you can map that in the docker run command | |
EXPOSE 8080 | |
CMD npm run test -s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment