Skip to content

Commit 3fc2a40

Browse files
committed
Add a docker container for easier local dev
1 parent 214b59a commit 3fc2a40

File tree

7 files changed

+52
-2
lines changed

7 files changed

+52
-2
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/gems
2+
_site
3+
.sass-cache
4+
.jekyll-metadata
5+
.bundle

.github/workflows/validate.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,14 @@ jobs:
2525

2626
- name: Build & Validate
2727
run: rake validate
28+
29+
docker:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
- name: Build container
35+
run: docker-compose build
36+
37+
- name: Build site in container
38+
run: docker-compose run docs rake build

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ruby:2.7
2+
3+
ENV GLOBAL_GEMS=true
4+
5+
WORKDIR /usr/src/docs
6+
7+
RUN gem install 'bundler:~>1' rake
8+
9+
COPY . ./
10+
11+
RUN rake dependencies
12+
13+
CMD ["rake", "dev"]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ The Student Robotics public documentation.
44

55
## Getting Started
66

7+
For ease of setup, a Docker container is provided. Simply install Docker and `docker-compose`, and run `docker-compose up`.
8+
9+
Once setup, the site will be accessible on http://localhost:4000/docs/
10+
11+
### Manual
12+
713
1. [Install Ruby][install-ruby]
814

915
2. Install Bundler (1.x) and Rake

Rakefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ task :deep_clean => [:clean] do
99
end
1010

1111
task :dependencies do
12-
sh('bundle install --path gems')
12+
if ENV["GLOBAL_GEMS"]
13+
sh('bundle install')
14+
else
15+
sh('bundle install --path gems')
16+
end
1317
end
1418

1519
file '_sass/brand/.git' do
@@ -19,7 +23,7 @@ end
1923
task :submodules => ['_sass/brand/.git']
2024

2125
task :dev => [:dependencies, :submodules] do
22-
sh('bundle exec jekyll serve --drafts --config _config.yml')
26+
sh('bundle exec jekyll serve --host 0.0.0.0 --drafts --config _config.yml')
2327
end
2428

2529
task :build => [:dependencies, :submodules] do

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ exclude:
5656
- Gemfile.lock
5757
- gems/
5858
- Dockerfile
59+
- docker-compose.yml
5960
- _env/
6061
- _docs/
6162
- vendor/

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "2.3"
2+
3+
services:
4+
docs:
5+
build:
6+
context: .
7+
volumes:
8+
- ".:/usr/src/docs"
9+
ports:
10+
- "4000:4000"

0 commit comments

Comments
 (0)