-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-jekyll.sh
executable file
·51 lines (48 loc) · 1.6 KB
/
docker-jekyll.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
# Jekyll Docker
# https://github.com/envygeeks/jekyll-docker
#
# Enable to simulate production features, e.g. comments
#
# --env JEKYLL_ENV=production
#
export JEKYLL_VERSION=latest
short_commit=$(git rev-parse --short HEAD)
pipeline_id="${GITHUB_RUN_ID:-0}"
version="v${pipeline_id}-${short_commit}"
echo "version: ${version}"
# gem sources
# List available sources
#
# bundle install
# Install gems in China because the official repository
# (https://rubygems.org) is not accessible in the mainland China.
docker run --rm \
-p 4000:4000 \
--env "BS_ENABLED=true" \
--env "BS_USERNAME=${BS_USERNAME}" \
--env "BS_PASSWORD=${BS_PASSWORD}" \
--env "SERVICE_VERSION=${version}" \
--name jekyll \
--volume "${PWD}:/srv/jekyll" \
--volume "${PWD}/vendor/bundle:/usr/local/bundle" \
-it "jekyll/jekyll:${JEKYLL_VERSION}" \
sh -c "echo \"gem version $(gem --version)\" && \
bundle --version && \
echo \"jekyll version $JEKYLL_VERSION\" && \
echo \"config bundle ...\" && \
bundle config mirror.https://rubygems.org https://mirrors.aliyun.com/rubygems/ && \
echo \"install bundle ...\" && \
bundle install --verbose && \
jekyll $@"
# sh -c "gem --version && \
# gem sources && \
# echo \"Removing official source...\" && \
# gem sources --remove https://rubygems.org/ && \
# gem sources && \
# echo \"Adding new mirror...\" && \
# gem sources --add https://mirrors.aliyun.com/rubygems/ && \
# gem sources && \
# bundle install --verbose && \
# jekyll $@"