diff --git a/.gitignore b/.gitignore index 2b039d19c..1553bb770 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,12 @@ # images /public/assets/images/* +/public/assets/images/yarn.lock +/public/assets/images/node_modules +!/public/assets/images/*.sh +!/public/assets/images/Dockerfile +!/public/assets/images/package.json +!/public/assets/images/gulpfile.js !/public/assets/images/icons/ !/public/assets/images/avatar-bg.png !/public/assets/images/chat-demo-avatar.png diff --git a/public/assets/images/Dockerfile b/public/assets/images/Dockerfile new file mode 100644 index 000000000..74310e6e9 --- /dev/null +++ b/public/assets/images/Dockerfile @@ -0,0 +1,16 @@ +FROM node:8-alpine + +ENV GULP_DIR "/tmp/gulp" + +RUN apk update && apk add bash +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +CMD bash # If you want to override CMD +RUN npm install -g gulp + +COPY docker-entrypoint.sh / + +# enable volume to generate build files into the hosts FS +VOLUME ["$GULP_DIR"] + +# start +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/public/assets/images/build.sh b/public/assets/images/build.sh new file mode 100755 index 000000000..5404964cb --- /dev/null +++ b/public/assets/images/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -o errexit +set -o pipefail + +docker build --no-cache -t zammad/svg-icons-build:latest . + +docker run --rm -v "$(pwd)/:/tmp/gulp" zammad/svg-icons-build:latest diff --git a/public/assets/images/docker-entrypoint.sh b/public/assets/images/docker-entrypoint.sh new file mode 100755 index 000000000..28cc6d57d --- /dev/null +++ b/public/assets/images/docker-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cd "${GULP_DIR}" || exit + +yarn + +gulp svgstore diff --git a/gulpfile.js b/public/assets/images/gulpfile.js similarity index 92% rename from gulpfile.js rename to public/assets/images/gulpfile.js index 05e320c2c..96211b7bb 100644 --- a/gulpfile.js +++ b/public/assets/images/gulpfile.js @@ -6,7 +6,7 @@ var svgmin = require('gulp-svgmin'); var cheerio = require('gulp-cheerio'); var through2 = require('through2'); -var iconsource = 'public/assets/images/icons/*.svg' +var iconsource = 'icons/*.svg' gulp.task('svgstore', function () { return gulp @@ -47,11 +47,11 @@ gulp.task('svgstore', function () { this.push(file); cb(); })) - .pipe(gulp.dest('public/assets/images')); + .pipe(gulp.dest('./')); }); gulp.task('watch', function () { gulp.watch(iconsource, ['svgstore']); }); -gulp.task('default', ['svgstore', 'watch']); \ No newline at end of file +gulp.task('default', ['svgstore', 'watch']); diff --git a/package.json b/public/assets/images/package.json similarity index 100% rename from package.json rename to public/assets/images/package.json