Add Docker support
This commit is contained in:
parent
bcfb8d8369
commit
175121e581
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -2,3 +2,4 @@ _output
|
|||
_site
|
||||
.jekyll-metadata
|
||||
/node_modules
|
||||
/vendor
|
||||
|
|
|
@ -2,41 +2,38 @@
|
|||
|
||||
## 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
|
||||
bundle install
|
||||
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
|
||||
SETX HOMEDRIVE %SYSTEMDRIVE% -m
|
||||
SETX HOMEPATH \Users\%username% -m
|
||||
SET HOME=%SYSTEMDRIVE%\Users\%USERNAME%
|
||||
SETX HOME "%HOME%"
|
||||
# Build images (takes ~12mins)
|
||||
docker-compose build
|
||||
|
||||
# First-time setup
|
||||
docker-compose run --rm web bundle install
|
||||
```
|
||||
|
||||
#### Start Jekyll and Webpack
|
||||
|
||||
Go wherever the project's files are located and open a new command prompt, execute the below commands:
|
||||
Starting the server:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
bundle install
|
||||
SET PORT=4001
|
||||
yarn run dev
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
## 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
|
|
@ -22,6 +22,8 @@ exclude:
|
|||
- package-lock.json
|
||||
- webpack.config.js
|
||||
- node_modules
|
||||
- Dockerfile
|
||||
- docker_compose.yml
|
||||
|
||||
# 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 yarn run dev'
|
||||
|
||||
volumes:
|
||||
rubygems:
|
Loading…
Reference in New Issue