Skip to content

Commit

Permalink
Use local resources, start using npm
Browse files Browse the repository at this point in the history
Adds bundled local assets and stops using toolforge to serve assets
  • Loading branch information
toban committed Nov 11, 2021
1 parent cf1157a commit 30f02e3
Show file tree
Hide file tree
Showing 12 changed files with 2,137 additions and 952 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
public_html/php
public_html/php
node_modules
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vendor
public_html/php
classes
classes
node_modules/
dist/
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
FROM node:12 as npm

WORKDIR /installing
COPY ./ /installing
RUN npm ci --only=production

FROM composer@sha256:d374b2e1f715621e9d9929575d6b35b11cf4a6dc237d4a08f2e6d1611f534675 as composer
# composer is pinned at a PHP 7 version

WORKDIR /installing
COPY ./ /installing
RUN composer install --no-dev --no-progress && rm -rf vendor/wbstack/magnustools

## 1. composer install
## 2. move magnus tools resources to a temp fold to select from (some are selected at the very end)
## 3. finally remove magnustools because it contains so much stuff
RUN composer install --no-dev --no-progress \
&& mv vendor/wbstack/magnustools /installing/magnustools \
&& rm -rf vendor/wbstack/magnustools

FROM php:7.2-apache

Expand All @@ -27,5 +38,9 @@ COPY --from=composer /installing /var/www/html/quickstatements
COPY --from=composer /installing/classes /var/www/html/magnustools/classes
COPY --from=composer /installing/public_html/php /var/www/html/magnustools/public_html/php

## TODO make some kind of sane magnus tools js lib to be included in the bundle
COPY --from=composer /installing/magnustools/public_html/resources /var/www/html/quickstatements/public_html/magnustools/resources
COPY --from=npm /installing/node_modules /var/www/html/quickstatements/public_html/resources

ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,24 @@ Using addwiki:
https://github.com/addwiki/mediawiki-api

Copy public_html/config.json.template to config.json and modify for your needs

## NPM Dependencies

Currently the external dependencies are managed by npm, they are installed during the building of the Dockerfile by running the following command

```
npm ci --only=production
```

and then moving the installed libraries to the public_html/ folder.

## TODO
### Add some kind of offline version of https://bitbucket.org/magnusmanske/tooltranslate.git

This could potentially be some kind of homebrew thing that looks at the toolinfo.json and pulls the all the translations when the Dockerfile builds and puts these in the `public_html/` folder

```
https://tools-static.wmflabs.org/tooltranslate/data/quickstatements/toolinfo.json
```

This would also require a rewrite of https://tools-static.wmflabs.org/tooltranslate/tt.js
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30f02e3

Please sign in to comment.