forked from pastakhov/docker-parsoid
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Ubuntu Dockerfile and new unit test script
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $1 ]]; then | ||
echo "[ERROR] Missing the image tag as arg!" >/dev/stderr | ||
echo "How to use: ./run-unit-tests.sh thenets/parsoid:0.11" | ||
exit 1 | ||
fi | ||
|
||
set -x | ||
DOCKER_IMAGE=$1 | ||
|
||
TEMP_DIR=$(mktemp -d) | ||
|
||
docker run -it --rm \ | ||
-w "/var/lib/parsoid" \ | ||
-v ${TEMP_DIR}/npm_logs:/root/.npm/_logs/ \ | ||
${DOCKER_IMAGE} \ | ||
npm test | ||
|
||
set +x | ||
|
||
echo "" | ||
echo "[DONE] Log files at: ${TEMP_DIR}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM node:13 | ||
|
||
LABEL maintainer="[email protected]" | ||
|
||
ENV PARSOID_HOME=/var/lib/parsoid \ | ||
PARSOID_USER=parsoid \ | ||
# PARSOID_VERSION [v0.8.1, v0.9.0, v0.10.0, v0.11.0, master] | ||
PARSOID_VERSION=v0.11.0 | ||
|
||
COPY run-parsoid.sh /run-parsoid.sh | ||
|
||
# Parsoid setup | ||
RUN set -x \ | ||
# Install required packages | ||
&& apt-get update \ | ||
&& apt-get install -y python git tar bash make | ||
|
||
RUN set -x \ | ||
# Add user | ||
&& useradd -M -u 1001 -s /bin/bash ${PARSOID_USER} \ | ||
# Set permissions | ||
&& chmod -v +x /run-parsoid.sh \ | ||
# Core | ||
&& mkdir -p ${PARSOID_HOME} \ | ||
&& git clone \ | ||
--branch ${PARSOID_VERSION} \ | ||
--single-branch \ | ||
--depth 1 \ | ||
--quiet \ | ||
https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid \ | ||
${PARSOID_HOME} | ||
|
||
RUN set -x \ | ||
&& cd ${PARSOID_HOME} \ | ||
&& npm install | ||
|
||
EXPOSE 8000 | ||
EXPOSE 8001 | ||
|
||
CMD ["/run-parsoid.sh"] |