From 58409ffc10802c002cd5697d7f8a37824c32cab4 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 2 Aug 2022 16:39:53 +0200 Subject: [PATCH] WIP: Run directly in Docker, take 1: install all dependencies runtime --- Dockerfile | 14 ++++++++++++++ README.rst | 17 ++++++++++++++--- docker-compose.yml | 18 ++++++++++++++++++ docker_entrypoint.sh | 3 +++ 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker_entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..364318b4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14-alpine +FROM python:3.10-alpine + +RUN mkdir /project + +RUN apk add --update npm + +RUN pip install poetry + +COPY docker_entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh + +CMD /entrypoint.sh \ No newline at end of file diff --git a/README.rst b/README.rst index 9c9bf10e..0a7aaadd 100644 --- a/README.rst +++ b/README.rst @@ -33,15 +33,26 @@ You will need to specify the ``FONTAWESOME_NPM_AUTH_TOKEN`` environment variable before installing Node dependenvies. You should be using ``direnv`` locally for secret management and encryption. Ask for this token, it's private. -You need to be using Node<=14 and at least Python 3.6+, but Python 3.10 is -preferred. Using ``asdf`` is recommended here. With both configured, you can -install all the dependencies with: +You need to be using Node<=14 and Python 3.10. +Using ``asdf`` is a great option for adding Python 3.10 to a system that doesn't have it. +h both configured, you can install all the dependencies with: .. code-block:: console $ poetry install $ npm install +Running in Docker +~~~~~~~~~~~~~~~~~ + +If you have Docker with docker-compose available, you can run a local development server like this: + +.. code-block:: console + + $ # invoke direnv to add secret environment + $ docker-compose build # builds the server + $ docker-compose up + Local development and authoring ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..65c7bdc1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' + +volumes: + build: + +services: + + server: + # Image used for all the other services (proxito, web, celery, build) + build: + context: ${PWD} + dockerfile: ./Dockerfile + environment: + - FONTAWESOME_NPM_AUTH_TOKEN=${FONTAWESOME_NPM_AUTH_TOKEN} + ports: + - "8000:8000" + volumes: + - ${PWD}/:/project diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh new file mode 100644 index 00000000..7f83e270 --- /dev/null +++ b/docker_entrypoint.sh @@ -0,0 +1,3 @@ +cd /project +poetry install +npm install \ No newline at end of file