From 1ad0d6ee33ee8472bab0759193557332e65f4829 Mon Sep 17 00:00:00 2001 From: baa-ableton <110462357+baa-ableton@users.noreply.github.com> Date: Sat, 20 Aug 2022 11:39:25 +0200 Subject: [PATCH] Added Dockerfile with alpine base (#1211) Co-authored-by: Babur Ayanlar --- .dockerignore | 3 +++ Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..c8d8c6817 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +demo/ +.git/ +.github/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..959e9e587 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM ruby:2.7-alpine + +RUN apk add --no-cache nodejs npm && \ + apk add --no-cache --virtual build-dependencies build-base + +WORKDIR /app + +ADD package.json /app/ +ADD package-lock.json /app/ +ADD package.json /app/ +ADD Gemfile /app/ +ADD Gemfile.lock /app/ +ADD _config.yml /app/ +ADD gulpfile.js /app/ + +# RUN apk update && apk add --virtual build-dependencies build-base +RUN npm install +RUN bundle config --global silence_root_warning 1 && bundler install --verbose + +# website +EXPOSE 3000 + +# website management (browser auto reload) +EXPOSE 3001 + +# run tabler +ENTRYPOINT [ "npm", "run", "start-plugins" ] \ No newline at end of file diff --git a/README.md b/README.md index 825e75feb..c8c100496 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,26 @@ Tabler is distributed via npm. npm install --save @tabler/core ``` +## Running with Docker + +If you don't want to install node/npm/ruby and the dependencies on your local environment, you can use the provided Dockerfile to build a docker image. +This Dockerfile is provided as an example to spin-up a container running Tabler. + +Example of how to use this image: + +1. Build the tabler image : `docker build -t tabler .` +2. Run the tabler image while mounting the `src` directory as well as the `_config.yml` file into the container. + +Don't forget to expose the port 3000 so you can browse the website locally. +You can also expose the port 3001 to have access to BrowserSync + +```sh +docker run -p 3000:3000 -p 3001:3001 -v $(pwd)/src:/app/src -v $(pwd)/_config.yml:/app/_config.yml tabler +``` + +Now open your browser to [http://localhost:3000](http://localhost:3000). Edit anything in the `src/` folder and watch your browser refresh the page after it has been rebuilt. + + ### CDN support All files included in `@tabler/core` npm package are available over a CDN.