Merge pull request #583 from rstacruz/feature/docker-support
Add Docker support for development
This commit is contained in:
commit
b93a60e8b4
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -2,3 +2,4 @@ _output
|
||||||
_site
|
_site
|
||||||
.jekyll-metadata
|
.jekyll-metadata
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/vendor
|
||||||
|
|
|
@ -2,41 +2,38 @@
|
||||||
|
|
||||||
## Starting a local instance
|
## Starting a local instance
|
||||||
|
|
||||||
This starts Jekyll and Webpack.
|
This starts Jekyll and Webpack. This requires recent versions of [Node.js], [Yarn], [Ruby] and [Bundler] installed.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
yarn install
|
yarn install
|
||||||
bundle install
|
bundle install
|
||||||
env PORT=4001 yarn run dev
|
env PORT=4001 yarn run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows
|
[node.js]: https://nodejs.org/en/download/package-manager/
|
||||||
|
[ruby]: https://www.ruby-lang.org/en/documentation/installation/
|
||||||
|
[yarn]: https://yarnpkg.com/en/docs/install
|
||||||
|
[bundler]: https://bundler.io/
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
You can also run a local instance using Docker. This is the preferred method, especially for Windows.
|
||||||
|
You only need to install Docker ([macOS](https://docs.docker.com/docker-for-mac/install/), [Windows](https://docs.docker.com/docker-for-windows/install/), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/), [Arch Linux](https://www.archlinux.org/packages/community/x86_64/docker/), [other](https://www.docker.com/community-edition#download)).
|
||||||
|
|
||||||
|
First time setup:
|
||||||
|
|
||||||
1. Install **Ruby**: https://rubyinstaller.org/
|
|
||||||
* After the installation check the box and type `3` to select the 3rd option
|
|
||||||
* Add `C:\msys64\usr\bin` to PATH env variable
|
|
||||||
* Add `C:\Ruby24-x64\bin` to PATH env variable
|
|
||||||
2. Install **yarn**: https://yarnpkg.com/en/docs/install#windows
|
|
||||||
3. Install **jekyll** via command prompt: `gem install jekyll bundler`
|
|
||||||
4. Install **nodejs && npm**: https://nodejs.org/en/download/
|
|
||||||
4. Install **webpack** via command prompt: `npm install -g webpack`
|
|
||||||
5. If you have any issues after installing ruby, like `HOMEPATH` is not defined, then execute the below commands:
|
|
||||||
```bash
|
```bash
|
||||||
SETX HOMEDRIVE %SYSTEMDRIVE% -m
|
# Build images (takes ~12mins)
|
||||||
SETX HOMEPATH \Users\%username% -m
|
docker-compose build
|
||||||
SET HOME=%SYSTEMDRIVE%\Users\%USERNAME%
|
|
||||||
SETX HOME "%HOME%"
|
# First-time setup
|
||||||
|
docker-compose run --rm web bundle install
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Start Jekyll and Webpack
|
Starting the server:
|
||||||
|
|
||||||
Go wherever the project's files are located and open a new command prompt, execute the below commands:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn install
|
docker-compose up
|
||||||
bundle install
|
|
||||||
SET PORT=4001
|
|
||||||
yarn run dev
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## CSS classes
|
## CSS classes
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
FROM ruby:2.5.1-alpine3.7
|
||||||
|
RUN apk update && apk add --no-cache nodejs build-base
|
||||||
|
RUN apk add yarn --no-cache --repository http://dl-3.alpinelinux.org/alpine/v3.8/community/ --allow-untrusted
|
||||||
|
RUN mkdir -p /app
|
||||||
|
WORKDIR /app
|
||||||
|
# COPY Gemfile Gemfile.lock ./
|
||||||
|
# RUN bundle install -j 4
|
||||||
|
# COPY package.json yarn.lock ./
|
||||||
|
# RUN yarn
|
5
Makefile
5
Makefile
|
@ -1,5 +1,6 @@
|
||||||
npmbin := ./node_modules/.bin
|
npmbin := ./node_modules/.bin
|
||||||
PORT ?= 3000
|
PORT ?= 3000
|
||||||
|
HOST ?= 127.0.0.1
|
||||||
|
|
||||||
# Builds intermediate files. Needs a _site built first though
|
# Builds intermediate files. Needs a _site built first though
|
||||||
update: _site critical
|
update: _site critical
|
||||||
|
@ -23,9 +24,9 @@ dev-webpack:
|
||||||
|
|
||||||
dev-jekyll:
|
dev-jekyll:
|
||||||
if [ -f _site ]; then \
|
if [ -f _site ]; then \
|
||||||
bundle exec jekyll serve --safe --trace --drafts --watch --incremental --port $(PORT); \
|
bundle exec jekyll serve --safe --trace --drafts --watch --incremental --host $(HOST) --port $(PORT); \
|
||||||
else \
|
else \
|
||||||
bundle exec jekyll serve --safe --trace --drafts --watch --port $(PORT); \
|
bundle exec jekyll serve --safe --trace --drafts --watch --host $(HOST) --port $(PORT); \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test: _site
|
test: _site
|
||||||
|
|
|
@ -22,6 +22,8 @@ exclude:
|
||||||
- package-lock.json
|
- package-lock.json
|
||||||
- webpack.config.js
|
- webpack.config.js
|
||||||
- node_modules
|
- node_modules
|
||||||
|
- Dockerfile
|
||||||
|
- docker_compose.yml
|
||||||
|
|
||||||
# Markdown
|
# Markdown
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- rubygems:/usr/local/bundle
|
||||||
|
ports:
|
||||||
|
- '4001:4001'
|
||||||
|
- '35729:35729'
|
||||||
|
command: 'env PORT=4001 HOST=0.0.0.0 yarn run dev'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
rubygems:
|
Loading…
Reference in New Issue