长代码警告
国内镜像 patch,都是泪啊
https://resource.literalkernel.work/mastodon.pitch
--- Dockerfile.orig 2020-08-19 20:00:38.850664964 +0800
+++ Dockerfile 2020-08-19 20:01:54.729742797 +0800
@@ -3,6 +3,10 @@
# Use bash for the shell
SHELL ["bash", "-c"]
+RUN apt update
+RUN apt install -y apt-transport-https ca-certificates
+COPY tsinghua.list /etc/apt/sources.list
+
# Install Node v12 (LTS)
ENV NODE_VER="12.16.3"
RUN ARCH= && \
@@ -20,7 +24,7 @@
apt update && \
apt -y install wget python && \
cd ~ && \
- wget https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER-linux-$ARCH.tar.gz && \
+ wget https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/v$NODE_VER/node-v$NODE_VER-linux-$ARCH.tar.gz && \
tar xf node-v$NODE_VER-linux-$ARCH.tar.gz && \
rm node-v$NODE_VER-linux-$ARCH.tar.gz && \
mv node-v$NODE_VER-linux-$ARCH /opt/node
@@ -47,7 +51,7 @@
bison libyaml-dev libgdbm-dev libreadline-dev \
libncurses5-dev libffi-dev zlib1g-dev libssl-dev && \
cd ~ && \
- wget https://cache.ruby-lang.org/pub/ruby/${RUBY_VER%.*}/ruby-$RUBY_VER.tar.gz && \
+ wget https://cache.ruby-china.com/pub/ruby/${RUBY_VER%.*}/ruby-$RUBY_VER.tar.gz && \
tar xf ruby-$RUBY_VER.tar.gz && \
cd ruby-$RUBY_VER && \
./configure --prefix=/opt/ruby \
@@ -60,6 +64,9 @@
ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin"
+RUN npm config set registry https://registry.npm.taobao.org
+RUN bundle config mirror.https://rubygems.org https://gems.ruby-china.com
+
RUN npm install -g yarn && \
gem install bundler && \
apt update && \
@@ -68,6 +75,8 @@
COPY Gemfile* package.json yarn.lock /opt/mastodon/
+RUN yarn config set registry https://registry.npm.taobao.org/
+
RUN cd /opt/mastodon && \
bundle config set deployment 'true' && \
bundle config set without 'development test' && \
长代码警告
@literalkernel 可以试一下用GitHub action构建,我常用这个,可以保存每一个步骤:https://github.com/marketplace/actions/build-and-push-docker-images
如果一定要本地构建务必配置好各种proxy,镜像不能彻底解决问题,尤其是gem
每个人都有属于自己的一片森林,也许我们从来不曾走过,但它一直在那里,总会在那里。迷失的人迷失了,相逢的人会再相逢。愿这里,成为属于你的小森林。