I want to use Jekyll on windows, but my computer’s default user path contains Chinese, and I always get an error when I execute the startup command. At this time, I thought about whether I can use docker to deploy a development environment, so I have this.
Dockerfile
FROM ubuntu:latest
LABEL authors="ljhsmn"
RUN useradd -m jekyll && usermod -a -G root jekyll \
&& su jekyll \
&& cp -a /etc/apt/sources.list /etc/apt/sources.list.bak \
&& sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
&& sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
&& echo '#InstallRubyGemsto~/gems' >> ~/.bashrc \
&& echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc \
&& echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc \
&& apt-get update \
&& apt-get install ruby-full build-essential zlib1g-dev -y && mkdir "jekyll" \
&& gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/ \
&& gem install jekyll bundler \
&& bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems
RUN chmod 775 -R /jekyll && chmod -R 775 /var/lib/gems/;
dcoker run command
docker build -t jekyllpage . && docker run -p 14000:4000 -v {your local project path}:/jekyll / --name jekyll --add-host host.docker.internal:host-gateway jekyllpage