From 46649124e3de86e64432f714c437713e8bff3ae1 Mon Sep 17 00:00:00 2001 From: Eric Newcomer Date: Fri, 11 Aug 2023 01:30:16 +0000 Subject: [PATCH] Dev container --- .devcontainer/Dockerfile | 10 ++++++++ .devcontainer/devcontainer.json | 17 +++++++++++++ Dockerfile | 28 ---------------------- package.json | 42 ++++++++++++++++----------------- 4 files changed, 48 insertions(+), 49 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json delete mode 100644 Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..219fc710 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +FROM "mcr.microsoft.com/devcontainers/typescript-node:1-16-bullseye" + +RUN apt-get update \ + && apt-get install chromium fonts-noto-color-emoji -y --no-install-recommends -qq + +# The rest of our environment +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true +ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium +ENV CHROME_PATH=/usr/bin/chromium +ENV DEBIAN_FRONTEND=noninteractive \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..f421bc08 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "temba-components", + "build": { + "dockerfile": "Dockerfile" + }, + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3010 + ] + // "postCreateCommand": "yarn start" + // Configure tool-specific properties. + // "customizations": {}, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 860f53f1..00000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM node:16-bullseye-slim - -# Install dependencies -RUN apt-get clean && apt-get update -qq && apt-get install -qq -y --no-install-recommends chromium fonts-noto-color-emoji -# RUN apk update && apk upgrade -# RUN apk add --update chromium font-noto-emoji - -# Set the locale -# RUN locale-gen --no-purge en_US.UTF-8 -ENV LANG=C.UTF-8 -ENV LC_ALL=C.UTF-8 - -# The rest of our environment -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true -ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium -ENV CHROME_PATH=/usr/bin/chromium -ENV DEBIAN_FRONTEND=noninteractive - -WORKDIR /code -# COPY ./package*.json . -# COPY ./yarn.lock . - -RUN yarn install -COPY /. /. - -EXPOSE 3010 - -# CMD ["yarn", "start"] \ No newline at end of file diff --git a/package.json b/package.json index 963ea027..db983b8e 100644 --- a/package.json +++ b/package.json @@ -9,27 +9,27 @@ "license": "AGPL-3.0-only", "repository": "https://github.com/nyaruka/temba-components/", "scripts": { - "start": "yarn concurrently --kill-others --names tsc,web-dev-server \"yarn tsc:watch\" \"web-dev-server --app-index demo/index.html --node-resolve --open --watch --port 3010 --esbuild-target auto\"", - "start:bg": "yarn concurrently --kill-others --names tsc,web-dev-server \"yarn tsc:watch\" \"web-dev-server --app-index demo/index.html --node-resolve --watch --port 3010 --esbuild-target auto\"", - "tsc:watch": "yarn tsc --watch", - "build": "yarn rimraf dist && yarn svg && tsc && rollup -c rollup.config.js", - "dev": "yarn build && cp -R ./dist/* ../rapidpro/node_modules/@nyaruka/temba-components/dist/ && cp -R ./dist/* ../floweditor/node_modules/@nyaruka/temba-components/dist/", - "postversion": "yarn git push --tags && git push origin main", - "lint:eslint": "yarn eslint --ext .ts . --ignore-path .gitignore", - "format:eslint": "yarn eslint --ext .ts . --fix --ignore-path .gitignore", - "lint:prettier": "yarn prettier \"**/*.js\" \"**/*.ts\" --check --ignore-path .gitignore", - "format:prettier": "yarn prettier \"**/*.js\" \"**/*.ts\" --write --ignore-path .gitignore", - "lint": "yarn lint:eslint && yarn lint:prettier", - "format": "yarn format:eslint && yarn format:prettier", - "test-file": "yarn rimraf out-tsc && tsc && web-test-runner --node-resolve --coverage", - "test": "yarn wtr --node-resolve --coverage", - "test:watch": "yarn wtr --node-resolve --watch", - "storybook": "yarn concurrently --kill-others --names tsc,storybook \"npm run tsc:watch\" \"start-storybook --node-resolve --watch --open\"", - "storybook:build": "yarn build-storybook", - "svg": "yarn rimraf static/svg/work && node svg.js --resolution=150", - "version": "yarn run build && auto-changelog -p && git add CHANGELOG.md", - "locale:extract": "yarn lit-localize extract --config localize.config.json", - "locale:build": "yarn lit-localize build --config localize.config.json" + "start": "concurrently --kill-others --names tsc,web-dev-server \"yarn tsc:watch\" \"web-dev-server --app-index demo/index.html --node-resolve --open --watch --port 3010 --esbuild-target auto\"", + "start:bg": "concurrently --kill-others --names tsc,web-dev-server \"yarn tsc:watch\" \"web-dev-server --app-index demo/index.html --node-resolve --watch --port 3010 --esbuild-target auto\"", + "tsc:watch": "tsc --watch", + "build": "rimraf dist && yarn svg && tsc && rollup -c rollup.config.js", + "dev": "build && cp -R ./dist/* ../rapidpro/node_modules/@nyaruka/temba-components/dist/ && cp -R ./dist/* ../floweditor/node_modules/@nyaruka/temba-components/dist/", + "postversion": "git push --tags && git push origin main", + "lint:eslint": "eslint --ext .ts . --ignore-path .gitignore", + "format:eslint": "eslint --ext .ts . --fix --ignore-path .gitignore", + "lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --check --ignore-path .gitignore", + "format:prettier": "prettier \"**/*.js\" \"**/*.ts\" --write --ignore-path .gitignore", + "lint": "lint:eslint && yarn lint:prettier", + "format": "format:eslint && yarn format:prettier", + "test-file": "rimraf out-tsc && tsc && web-test-runner --node-resolve --coverage", + "test": "wtr --node-resolve --coverage", + "test:watch": "wtr --node-resolve --watch", + "storybook": "concurrently --kill-others --names tsc,storybook \"npm run tsc:watch\" \"start-storybook --node-resolve --watch --open\"", + "storybook:build": "build-storybook", + "svg": "rimraf static/svg/work && node svg.js --resolution=150", + "version": "run build && auto-changelog -p && git add CHANGELOG.md", + "locale:extract": "lit-localize extract --config localize.config.json", + "locale:build": "lit-localize build --config localize.config.json" }, "dependencies": { "@lit/localize": "^0.11.4",