forked from songxiaofeng1981/best
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (44 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
58 lines (44 loc) · 1.43 KB
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
52
53
54
55
56
57
58
# 使用 Ubuntu 作为基础镜像
FROM ubuntu:latest
# 安装依赖
RUN apt-get update && apt-get install -y \
curl \
build-essential \
libssl-dev \
libreadline-dev \
zlib1g-dev \
libsqlite3-dev \
zsh \
vim
# 安装 RVM (Ruby Version Manager)
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - \
&& curl -sSL https://get.rvm.io | bash -s stable
# 添加 RVM 到 PATH
ENV PATH="/usr/local/rvm/bin:$PATH"
# 激活 RVM
RUN /bin/bash -l -c "source /usr/local/rvm/scripts/rvm"
# 设置默认 shell 为登录 shell
SHELL ["/bin/bash", "-l", "-c"]
# 安装 Ruby
# 替换下面的 "3.1.2" 为 Gemfile 中指定的 Ruby 版本
RUN /bin/bash -l -c "rvm install 3.1.2 && rvm use 3.1.2 --default"
# 安装 Node.js 和 npm
RUN apt-get install -y nodejs npm
# 安装 Jekyll 和 Bundler
RUN /bin/bash -l -c "gem install jekyll bundler"
# 安装其他依赖
RUN apt-get install -y imagemagick libvips
# 安装 Squoosh CLI
RUN npm install @squoosh/cli -g
# 创建一个目录来存放应用程序代码
WORKDIR /app
# 安装 Ruby 依赖
COPY app/Gemfile app/Gemfile.lock /app/
RUN /bin/bash -l -c "bundle install"
# 拷贝您的应用程序代码到镜像中
COPY app/ /app
# 拷贝处理图片和构建网站的脚本到镜像中
COPY process-images.sh /process-images.sh
COPY build-site.sh /build-site.sh
RUN chmod +x /process-images.sh /build-site.sh