diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 69fad35..0000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "bower_components" -} diff --git a/.dockerignore b/.dockerignore index 6b93a3b..071fae3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,6 @@ node_modules dist .tmp .saas-cache -bower_components screenshots *~ *.swp diff --git a/.gitignore b/.gitignore index fdc8139..503e460 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ node_modules dist .tmp .sass-cache -bower_components *~ *.swp diff --git a/Dockerfile b/Dockerfile index 1a78f0e..6eea346 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,52 @@ -FROM debian:jessie -MAINTAINER "Konrad Kleine" +################################################################################ +# Stage 1: Build the Angluar application +################################################################################ +FROM node:8-alpine as build_app +LABEL maintainer="Konrad Kleine" + +ENV WORKDIR=/usr/src +RUN mkdir -p $WORKDIR \ + $WORKDIR/.git + +WORKDIR $WORKDIR + +# The node image removes these packages as they are only needed to build node not to run it +# Since we are installing/building npm packages will need these in the image +RUN apk add --no-cache --virtual .build-deps \ + automake \ + autoconf \ + gcc \ + g++ \ + make \ + nasm \ + python \ + zlib-dev + +COPY . $WORKDIR + +RUN npm install \ + && apk del .build-deps + +# Add some git files for versioning +ADD .git/HEAD $WORKDIR/.git/HEAD +ADD .git/refs $WORKDIR/.git/refs + +# Create version file +RUN export GITREF=$(cat .git/HEAD | cut -d" " -f2) && \ + export GITSHA1=$(cat .git/$GITREF) && \ + echo "{\"git\": {\"sha1\": \"$GITSHA1\", \"ref\": \"$GITREF\"}}" > app-version.json + +## Build App +RUN node_modules/grunt-cli/bin/grunt build --allow-root +################################################################################ +# Stage 2: Run the Angular application +################################################################################ + +FROM debian:jessie +LABEL maintainer="Konrad Kleine" + USER root ############################################################ @@ -9,7 +54,6 @@ USER root ############################################################ ENV WWW_DIR /var/www/html -ENV SOURCE_DIR /tmp/source ENV START_SCRIPT /root/start-apache.sh RUN mkdir -pv $WWW_DIR @@ -28,32 +72,8 @@ RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache ############################################################ -# Create dirs -RUN mkdir -p $SOURCE_DIR/dist \ - $SOURCE_DIR/app \ - $SOURCE_DIR/test \ - $SOURCE_DIR/.git - -# Add dirs -ADD app $SOURCE_DIR/app -ADD test $SOURCE_DIR/test - -# Dot files -ADD .jshintrc $SOURCE_DIR/ -ADD .bowerrc $SOURCE_DIR/ -ADD .editorconfig $SOURCE_DIR/ -ADD .travis.yml $SOURCE_DIR/ - -# Other files -ADD bower.json $SOURCE_DIR/ -ADD Gruntfile.js $SOURCE_DIR/ -ADD LICENSE $SOURCE_DIR/ -ADD package.json $SOURCE_DIR/ -ADD README.md $SOURCE_DIR/ - -# Add some git files for versioning -ADD .git/HEAD $SOURCE_DIR/.git/HEAD -ADD .git/refs $SOURCE_DIR/.git/refs +COPY --from=build_app /usr/src/dist/ $WWW_DIR/ +COPY --from=build_app /usr/src/app-version.json $WWW_DIR/app-version.json ############################################################ # Install and configure webserver software @@ -63,30 +83,11 @@ RUN apt-get -y update && \ export DEBIAN_FRONTEND=noninteractive && \ apt-get -y install \ apache2 \ - bzip2 \ libapache2-mod-auth-kerb \ libapache2-mod-proxy-html \ - git \ - nodejs \ - nodejs-legacy \ - npm \ --no-install-recommends && \ a2enmod proxy && \ a2enmod proxy_http && \ - cd $SOURCE_DIR && \ - export GITREF=$(cat .git/HEAD | cut -d" " -f2) && \ - export GITSHA1=$(cat .git/$GITREF) && \ - echo "{\"git\": {\"sha1\": \"$GITSHA1\", \"ref\": \"$GITREF\"}}" > $WWW_DIR/app-version.json && \ - cd $SOURCE_DIR && \ - rm -rf $SOURCE_DIR/.git && \ - git config --global url."https://".insteadOf git:// && \ - cd $SOURCE_DIR && \ - npm install && \ - node_modules/bower/bin/bower install --allow-root && \ - node_modules/grunt-cli/bin/grunt build --allow-root && \ - cp -rf $SOURCE_DIR/dist/* $WWW_DIR && \ - rm -rf $SOURCE_DIR && \ - apt-get -y --auto-remove purge git nodejs nodejs-legacy npm bzip2 && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Gruntfile.js b/Gruntfile.js index 5f5bdad..617fec1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -22,7 +22,7 @@ module.exports = function (grunt) { // Configurable paths for the application var appConfig = { - app: require('./bower.json').appPath || 'app', + app: 'app', dist: 'dist' }; @@ -34,10 +34,6 @@ module.exports = function (grunt) { // Watches files for changes and runs tasks based on the changed files watch: { - bower: { - files: ['bower.json'], - tasks: ['wiredep'] - }, js: { files: ['<%= yeoman.app %>/{,*/}*.js'], tasks: ['newer:jshint:all'], @@ -105,8 +101,8 @@ module.exports = function (grunt) { middlewares.push( connect.static('.tmp'), connect().use( - '/bower_components', - connect.static('./bower_components') + '/node_modules', + connect.static('./node_modules') ), connect.static(appConfig.app) ); @@ -123,8 +119,8 @@ module.exports = function (grunt) { connect.static('.tmp'), connect.static('test'), connect().use( - '/bower_components', - connect.static('./bower_components') + '/node_modules', + connect.static('./node_modules') ), connect.static(appConfig.app) ]; @@ -189,14 +185,6 @@ module.exports = function (grunt) { } }, - // Automatically inject Bower components into the app - wiredep: { - app: { - src: ['<%= yeoman.app %>/index.html'], - ignorePath: /\.\.\// - } - }, - // Renames files for browser caching purposes filerev: { dist: { @@ -316,13 +304,6 @@ module.exports = function (grunt) { } }, - // Replace Google CDN references - cdnify: { - dist: { - html: ['<%= yeoman.dist %>/*.html'] - } - }, - // Copies remaining files to places other tasks can use copy: { dist: { @@ -346,7 +327,7 @@ module.exports = function (grunt) { src: ['generated/*'] }, { expand: true, - cwd: 'bower_components/bootstrap/dist', + cwd: 'node_modules/bootstrap/dist', src: 'fonts/*', dest: '<%= yeoman.dist %>' }] @@ -391,7 +372,6 @@ module.exports = function (grunt) { grunt.task.run([ 'clean:server', - 'wiredep', 'concurrent:server', 'autoprefixer', 'configureProxies:server', @@ -415,14 +395,12 @@ module.exports = function (grunt) { grunt.registerTask('build', [ 'clean:dist', - 'wiredep', 'useminPrepare', 'concurrent:dist', 'autoprefixer', 'concat', 'ngAnnotate', 'copy:dist', - 'cdnify', 'cssmin', 'uglify', 'filerev', diff --git a/app/about.html b/app/about.html index 3b5c469..8270a70 100644 --- a/app/about.html +++ b/app/about.html @@ -49,11 +49,11 @@
The Bower package manager is used to manage all the dependencies of the code.
- +The NPM package manager is used to manage all the dependencies of the code.
+
diff --git a/app/tag/tag-list-directive.html b/app/tag/tag-list-directive.html
index c9fc235..8edfc3a 100644
--- a/app/tag/tag-list-directive.html
+++ b/app/tag/tag-list-directive.html
@@ -10,7 +10,8 @@
- Tag
+
+ Tag
Image ID
Created
Author
@@ -19,13 +20,19 @@
-
-
+
+
+
+
+
-
-
- {{tag.name}}
+
+
+
+
+
+ {{tag.name}}
diff --git a/bower.json b/bower.json
deleted file mode 100644
index d85d631..0000000
--- a/bower.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "name": "docker-registry-frontend",
- "version": "0.0.0",
- "dependencies": {
- "angular": "~1.3.0",
- "json3": "~3.3.1",
- "es5-shim": "~3.1.0",
- "bootstrap": "3.3.4",
- "angular-resource": "~1.3.0",
- "angular-cookies": "~1.3.0",
- "angular-sanitize": "~1.3.0",
- "angular-animate": "~1.3.0",
- "angular-touch": "~1.3.0",
- "angular-route": "~1.3.0",
- "toastr": "~2.0.3",
- "angular-bootstrap": "~0.13.0",
- "angular-loading-bar": "~0.6.0",
- "angular-moment": "~0.8.2",
- "angular-smart-table": "~1.3.0",
- "angular-filter": "~0.5.2",
- "angular-bootstrap-checkbox": "~0.3.1"
- },
- "devDependencies": {
- "angular-mocks": "~1.3.0",
- "angular-scenario": "~1.3.0"
- },
- "resolutions": {
- "angular": "~1.3.0"
- },
- "appPath": "app"
-}
diff --git a/develop/Dockerfile b/develop/Dockerfile
index 4a151b6..c5a7ba4 100644
--- a/develop/Dockerfile
+++ b/develop/Dockerfile
@@ -1,8 +1,20 @@
-FROM ubuntu:14.04
+FROM node:8-alpine
MAINTAINER "Konrad Kleine"
USER root
+# The node image removes these packages as they are only needed to build node not to run it
+# Since we update npm package at start up will need these in the image
+RUN apk add --no-cache \
+ bash \
+ curl \
+ gcc \
+ g++ \
+ git \
+ make \
+ nano \
+ python
+
############################################################
# Setup environment variables
############################################################
@@ -10,39 +22,6 @@ USER root
ENV SOURCE_DIR /source
ENV START_SCRIPT /root/start-develop.sh
-############################################################
-# Speedup DPKG and don't use cache for packages
-############################################################
-
-# Taken from here: https://gist.github.com/kwk/55bb5b6a4b7457bef38d
-#
-# this forces dpkg not to call sync() after package extraction and speeds up
-# install
-RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
-# we don't need and apt cache in a container
-RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
-
-RUN apt-get -y update && \
- export DEBIAN_FRONTEND=noninteractive
-
-############################################################
-# Install development requirements
-############################################################
-
-RUN apt-get -y install \
- git \
- nodejs \
- nodejs-legacy \
- npm \
- --no-install-recommends
-RUN git config --global url."https://".insteadOf git://
-# Avoid this: "Problem with the SSL CA cert (path? access rights?)"
-RUN git config --global http.sslVerify false
-
-############################################################
-# Create start script
-############################################################
-
# Let people know how this was built
ADD Dockerfile /root/Dockerfile
diff --git a/develop/docker-compose.yml b/develop/docker-compose.yml
index 3ac4b0a..bd81284 100644
--- a/develop/docker-compose.yml
+++ b/develop/docker-compose.yml
@@ -1,16 +1,29 @@
-frontend:
- build: .
- links:
- - registry:path-to-your-registry-v2
- ports:
- # Serves the page via grunt
- - "9000:9000"
- # For live reload with grunt
- - "35729:35729"
- volumes:
- - ../:/source:rw
- - ./start-develop.sh:/root/start-develop.sh:ro
-registry:
- image: registry:2.1.1
- ports:
- - "5000:5000"
+version: '3.2'
+
+services:
+ frontend:
+ build: .
+ ports:
+ # Serves the page via grunt
+ - "9000:9000"
+ # For live reload with grunt
+ - "35729:35729"
+ depends_on:
+ - registry
+ volumes:
+ - ../:/source:rw
+ - ./start-develop.sh:/root/start-develop.sh:ro
+ environment:
+ - DOCKER_REGISTRY_HOST=registry
+ - DOCKER_REGISTRY_PORT=5000
+ registry:
+ image: registry:2.1.1
+ expose:
+ - "5000"
+ networks:
+ dev_net:
+ aliases:
+ - path-to-your-registry-v2
+
+networks:
+ dev_net:
diff --git a/develop/start-develop.sh b/develop/start-develop.sh
index 72c3cf5..142b5a7 100755
--- a/develop/start-develop.sh
+++ b/develop/start-develop.sh
@@ -3,5 +3,4 @@ set -x
set -e
cd $SOURCE_DIR
npm install
-node_modules/bower/bin/bower install --allow-root
node_modules/grunt-cli/bin/grunt serve --allow-root
diff --git a/package.json b/package.json
index 305a7a1..5a4a5b3 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,58 @@
{
"name": "docker-registry-frontend",
+ "description": "A pure web-based frontend to a docker-registry",
"version": "0.0.2",
- "dependencies": {},
+ "author": "Konrad Kleine",
+ "license": "MIT",
+ "keywords": [
+ "docker",
+ "registry",
+ "frontend",
+ "ui"
+ ],
+ "main": "Gruntfile.js",
+ "directories": {
+ "test": "test"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:kwk/docker-registry-frontend.git"
+ },
+ "bugs": {
+ "url": "https://github.com/kwk/docker-registry-frontend/issues"
+ },
+ "scripts": {
+ "start": "grunt serve",
+ "pretest": "npm install",
+ "test": "karma start test/karma.conf.js",
+ "test-single-run": "karma start test/karma.conf.js --single-run"
+ },
+ "dependencies": {
+ "angular": "~1.3.0",
+ "angular-animate": "~1.3.0",
+ "angular-bootstrap-checkbox": "~0.5.0",
+ "angular-cookies": "~1.3.0",
+ "angular-filter": "~0.5.2",
+ "angular-loading-bar": "~0.6.0",
+ "angular-moment": "~0.8.2",
+ "angular-resource": "~1.3.0",
+ "angular-route": "~1.3.0",
+ "angular-sanitize": "~1.3.0",
+ "angular-smart-table": "~1.4.12",
+ "angular-touch": "~1.3.0",
+ "angular-ui-bootstrap": "~0.13.0",
+ "bootstrap": "3.3.4",
+ "es5-shim": "~3.2.0",
+ "jquery": "^2.1.4",
+ "json3": "~3.3.1",
+ "toastr": "~2.0.3"
+ },
"devDependencies": {
- "bower": "^1.7.2",
+ "angular-mocks": "~1.3.0",
+ "angular-scenario": "~1.3.0",
"connect-modrewrite": "^0.8.2",
"grunt": "^0.4.1",
"grunt-autoprefixer": "^3.0.3",
@@ -37,35 +86,5 @@
"karma-spec-reporter": "0.0.26",
"load-grunt-tasks": "^3.4.0",
"time-grunt": "^1.3.0"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "server": "grunt serve",
- "postinstall": "bower install",
- "pretest": "npm install",
- "test": "karma start test/karma.conf.js",
- "test-single-run": "karma start test/karma.conf.js --single-run"
- },
- "description": "A pure web-based frontend to a docker-registry",
- "main": "Gruntfile.js",
- "directories": {
- "test": "test"
- },
- "repository": {
- "type": "git",
- "url": "git@github.com:kwk/docker-registry-frontend.git"
- },
- "keywords": [
- "docker",
- "registry",
- "frontend",
- "ui"
- ],
- "author": "Konrad Kleine",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/kwk/docker-registry-frontend/issues"
}
}
diff --git a/start-apache.sh b/start-apache.sh
old mode 100644
new mode 100755
index a5c5b9b..7489331
--- a/start-apache.sh
+++ b/start-apache.sh
@@ -37,8 +37,6 @@ echo "{\"host\": \"$ENV_REGISTRY_PROXY_FQDN\", \"port\": $ENV_REGISTRY_PROXY_POR
# information about browse mode.
[[ x$ENV_MODE_BROWSE_ONLY =~ ^x(true|false)$ ]] || ENV_MODE_BROWSE_ONLY=false
-# Overwrite browse-only option for now since only browse-only is working right now
-ENV_MODE_BROWSE_ONLY=true
[[ -z "$ENV_DEFAULT_REPOSITORIES_PER_PAGE" ]] && ENV_DEFAULT_REPOSITORIES_PER_PAGE=20
[[ -z "$ENV_DEFAULT_TAGS_PER_PAGE" ]] && ENV_DEFAULT_TAGS_PER_PAGE=10
echo "{\"browseOnly\":$ENV_MODE_BROWSE_ONLY, \"defaultRepositoriesPerPage\":$ENV_DEFAULT_REPOSITORIES_PER_PAGE , \"defaultTagsPerPage\":$ENV_DEFAULT_TAGS_PER_PAGE }" > /var/www/html/app-mode.json
@@ -86,4 +84,11 @@ a2enmod rewrite
# Stop apache first if is still running from the last time the container was run
service apache2 stop
+# apache2.pid can hang around from previous dirty exits
+# (https://github.com/kwk/docker-registry-frontend/issues/159)
+if [ -f /var/run/apache2/apache2.pid ]
+then
+ rm /var/run/apache2/apache2.pid
+fi
+
/usr/sbin/apache2ctl -D FOREGROUND ${useSsl}
diff --git a/test/init-smart-table.js b/test/init-smart-table.js
new file mode 100644
index 0000000..07af0f6
--- /dev/null
+++ b/test/init-smart-table.js
@@ -0,0 +1 @@
+ng = angular;
diff --git a/test/karma.conf.js b/test/karma.conf.js
index da47709..a28090e 100644
--- a/test/karma.conf.js
+++ b/test/karma.conf.js
@@ -20,20 +20,21 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
- 'bower_components/angular/angular.js',
- 'bower_components/angular-animate/angular-animate.js',
- 'bower_components/angular-bootstrap/ui-bootstrap.js',
- 'bower_components/angular-bootstrap-checkbox/angular-bootstrap-checkbox.js',
- 'bower_components/angular-cookies/angular-cookies.js',
- 'bower_components/angular-filter/dist/angular-filter.js',
- 'bower_components/angular-loading-bar/src/loading-bar.js',
- 'bower_components/angular-mocks/angular-mocks.js',
- 'bower_components/angular-moment/angular-moment.js',
- 'bower_components/angular-resource/angular-resource.js',
- 'bower_components/angular-route/angular-route.js',
- 'bower_components/angular-sanitize/angular-sanitize.js',
- 'bower_components/angular-smart-table/src/smart-table.module.js',
- 'bower_components/angular-touch/angular-touch.js',
+ 'node_modules/angular/angular.js',
+ 'node_modules/angular-animate/angular-animate.js',
+ 'node_modules/angular-ui-bootstrap/ui-bootstrap.js',
+ 'node_modules/angular-bootstrap-checkbox/angular-bootstrap-checkbox.js',
+ 'node_modules/angular-cookies/angular-cookies.js',
+ 'node_modules/angular-filter/dist/angular-filter.js',
+ 'node_modules/angular-loading-bar/src/loading-bar.js',
+ 'node_modules/angular-mocks/angular-mocks.js',
+ 'node_modules/angular-moment/angular-moment.js',
+ 'node_modules/angular-resource/angular-resource.js',
+ 'node_modules/angular-route/angular-route.js',
+ 'node_modules/angular-sanitize/angular-sanitize.js',
+ 'test/init-smart-table.js',
+ 'node_modules/angular-smart-table/src/smart-table.module.js',
+ 'node_modules/angular-touch/angular-touch.js',
'app/**/*.js',
'test/spec/**/*.js'
],