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 d2c53fe
Show file tree
Hide file tree
Showing 11 changed files with 2,133 additions and 949 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/
25 changes: 24 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
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

## TODO add this somehow
#RUN git clone https://bitbucket.org/magnusmanske/tooltranslate.git

## 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/public_html/resources /installing/magnustools/ \
&& rm -rf vendor/wbstack/magnustools

FROM php:7.2-apache

Expand All @@ -27,5 +41,14 @@ 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 ToolTranslate
#COPY --from=composer /installing/tooltranslate/public_html/tt.js /var/www/html/quickstatements/public_html/tooltranslate/

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

ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]
12 changes: 12 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@ 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.


Loading

0 comments on commit d2c53fe

Please sign in to comment.