Rails 8.1 + SQLite app - 2026-02-04 22:51:42

This commit is contained in:
2026-02-04 22:51:42 +08:00
commit 70f4740359
12 changed files with 699 additions and 0 deletions

39
Dockerfile Normal file
View File

@@ -0,0 +1,39 @@
# 使用Ruby 3.3官方镜像
FROM ruby:3.3-slim
# 安装系统依赖
RUN apt-get update -qq && \
apt-get install -y \
build-essential \
libsqlite3-dev \
nodejs \
npm \
git \
curl && \
rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 安装Rails 8.1
RUN gem install rails -v '8.1.0' --no-document
# 复制启动脚本
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# 复制Gemfile
COPY Gemfile* ./
RUN bundle install || true
# 复制应用代码
COPY . .
# 创建必要的目录
RUN mkdir -p /app/db /app/storage /app/tmp /app/log
# 暴露端口
EXPOSE 3000
# 启动命令
CMD ["/app/start.sh"]