diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000000000000000000000000000000000000..931dbb1bec61370ac1754347a50595f3e3f4e521 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,5 @@ +:80 { + root * /srv + file_server browse + header Access-Control-Allow-Origin "*" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d89317f1d520f899d10483b1d0aac8c46ba2bad2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:latest as builder +RUN apk add npm git + +COPY . /opt +WORKDIR /opt +RUN npm install +RUN npm run build + +FROM caddy:latest as httpd +COPY --from=builder /opt/public /srv diff --git a/README.md b/README.md index 4baf1cfa3c3d800974eea87e3f67f0ef82d9b6c5..450b915c82b298b04dcf8b6736a38f46cd88286f 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,3 @@ -## Integrating Mirador +## Mirador Video Annotation POC -This repository is designed to show integrating Mirador 3 with modern frontend build systems. - -### Dependencies - -You will likely need to have at least the following dependencies available in your `package.json`. - - - `mirador` - - `react` - - `react-dom` - - `mirador-image-tools` - A plugin just to test plugin integration - -### Webpack - -See `./webpack` for a basic webpack setup for Mirador 3 + a plugin. - -```sh -npm run webpack -``` - -### Parcel - -See `./parcel`, but essentially it is just an html file referencing the JavaScript. - -```sh -npm run parcel -``` +Run `docker-compose up -d`, which will serve a mirador instance to `http://localhost:8080`. The `www` directory is accessible via `http://localhost:8080/data` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..287e29b316709422302a0806aec319d2e1767013 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3.9" +services: + httpd: + build: . + restart: unless-stopped + ports: + - "8080:80" + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile diff --git a/package.json b/package.json index dc164001f2e90cb76f88ba1f533116c0e3bd304b..c247ee3f4313baa2464e4e3140ee5694f4a732d9 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "", "private": true, "scripts": { - "webpack": "webpack --config webpack/webpack.config.js", - "test": "echo \"Error: no test specified\" && exit 1" + "build": "webpack --config webpack.config.js", + "serve": "webpack serve --config webpack.config.js" }, "author": "", "license": "ISC", @@ -14,7 +14,9 @@ "mirador": "git+https://gitlab.tetras-libre.fr/iiif/mirador-video-annotation#wip-webpack-from-git", "react": "^16.13.1", "react-dom": "^16.13.1", - "style-loader": "^1.2.1", + "style-loader": "^1.2.1" + }, + "devDependencies": { "webpack": "^4.43.0", "webpack-cli": "^4.3.12" } diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000000000000000000000000000000000000..e7842b1fdae6cbf055d4eb965853a4bb510e52ab --- /dev/null +++ b/public/index.html @@ -0,0 +1,11 @@ +<!doctype html> +<html> + <head> + <meta charset="utf-8" /> + <title>Mirador Video Annotations</title> + </head> + <body> + <div id="demo"></div> + <script src="/dist/main.js"></script> + </body> +</html> diff --git a/src/index.js b/src/index.js index f0b501b55d4ef7ada83a58d2d5f18b7559bf9ef4..b48229426bb8e2bf89602a5b31a8bbe242708556 100644 --- a/src/index.js +++ b/src/index.js @@ -1,20 +1,7 @@ -import Mirador from 'mirador/dist/es/src/index'; - +import Mirador from 'mirador/dist/es/src/index' const config = { - id: 'demo', - theme: { transitions: window.location.port === '4488' ? { create: () => 'none' } : {}, }, - catalog: [ - { manifestId: 'http://localhost/dzkimgs_annotated_video.json' }, - { manifestId: 'http://localhost/video_split_annopage.json' }, - { manifestId: 'http://localhost/fediverse.json' }, - { manifestId: 'http://localhost/localvideo.json' }, - { manifestId: 'http://localhost/local_catvideo.json' }, - { manifestId: 'https://dzkimgs.l.u-tokyo.ac.jp/videos/iiif_in_japan_2017/manifest.json' }, - { manifestId: 'https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json' }, - { manifestId: 'https://iiif.harvardartmuseums.org/manifests/object/299843' } - ] + id: 'demo' } -Mirador.viewer(config, [ -]); +Mirador.viewer(config, []) diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000000000000000000000000000000000000..d487af5301c2a2d03037db99295c2bcbee3bb9a4 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,10 @@ +const path = require('path'); + +module.exports = { + entry: './src/index.js', + output: { + filename: 'main.js', + path: path.resolve(__dirname, 'public/dist'), + publicPath: './dist/', + } +};