From b601ac6f91d266ffa2555d16dbf1a814f364b4b2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 12 Feb 2022 14:06:18 -0800 Subject: [PATCH] Adds dev tools docker image --- bw-dev | 10 +++++----- dev-tools-docker/Dockerfile | 15 +++++++++++++++ package.json => dev-tools-docker/package.json | 0 dev-tools-docker/requirements.txt | 1 + docker-compose.yml | 5 +++++ requirements.txt | 1 - 6 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 dev-tools-docker/Dockerfile rename package.json => dev-tools-docker/package.json (100%) create mode 100644 dev-tools-docker/requirements.txt diff --git a/bw-dev b/bw-dev index cec425393..ebf75e8e6 100755 --- a/bw-dev +++ b/bw-dev @@ -35,7 +35,7 @@ function initdb { } function makeitblack { - runweb black celerywyrm bookwyrm + docker-compose run --rm dev-tools black celerywyrm bookwyrm } function awscommand { @@ -135,15 +135,15 @@ case "$CMD" in makeitblack ;; prettier) - npx prettier --write bookwyrm/static/js/*.js + docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js ;; stylelint) - npx stylelint bookwyrm/static/**/*.css --fix + docker-compose run --rm dev-tools npx stylelint bookwyrm/static/**/*.css --fix ;; formatters) makeitblack - npx prettier --write bookwyrm/static/js/*.js - npx stylelint bookwyrm/static/**/*.css --fix + docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js + docker-compose run --rm dev-tools npx stylelint bookwyrm/static/**/*.css --fix ;; update) git pull diff --git a/dev-tools-docker/Dockerfile b/dev-tools-docker/Dockerfile new file mode 100644 index 000000000..35286aa6f --- /dev/null +++ b/dev-tools-docker/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.9 + +ENV PYTHONUNBUFFERED 1 + +RUN mkdir /app /app/static /app/images + +WORKDIR /app + +COPY package.json requirements.txt /app/ +RUN pip install black + +RUN apt-get update && apt-get install -y curl +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - +RUN apt-get install -y nodejs +RUN npm install . diff --git a/package.json b/dev-tools-docker/package.json similarity index 100% rename from package.json rename to dev-tools-docker/package.json diff --git a/dev-tools-docker/requirements.txt b/dev-tools-docker/requirements.txt new file mode 100644 index 000000000..c2014be7c --- /dev/null +++ b/dev-tools-docker/requirements.txt @@ -0,0 +1 @@ +black==21.4b2 diff --git a/docker-compose.yml b/docker-compose.yml index 672ea4c1a..bffa1a087 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,6 +84,11 @@ services: - db - redis_broker restart: on-failure + dev-tools: + build: dev-tools-docker + env_file: .env + volumes: + - .:/app volumes: pgdata: static_volume: diff --git a/requirements.txt b/requirements.txt index e6d66c5df..94e4d9914 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,7 +25,6 @@ opentelemetry-instrumentation-django==0.27b0 opentelemetry-instrumentation-celery==0.27b0 # Dev -black==21.4b2 pytest-django==4.1.0 pytest==6.1.2 pytest-cov==2.10.1