Этот коммит содержится в:
Mattia Roccoberton
2025-04-04 08:14:53 +02:00
родитель bc140179f2
Коммит 97dbabce09
20 изменённых файлов: 156 добавлений и 183 удалений

3
extra/.bashrc Обычный файл
Просмотреть файл

@@ -0,0 +1,3 @@
alias ls='ls --color'
alias ll='ls -l'
alias la='ls -la'

7
extra/.env Обычный файл
Просмотреть файл

@@ -0,0 +1,7 @@
COMPOSE_PROJECT_NAME=activeadmin_quill_editor
BUNDLER_VERSION=2.5.23
SERVER_PORT=4000
UID=1000
GID=1000

Просмотреть файл

@@ -1,21 +1,31 @@
ARG RUBY_IMAGE=ruby:3
FROM ${RUBY_IMAGE}
ARG UID
ENV DEBIAN_FRONTEND=noninteractive
ENV DEVEL=1
ENV LANG=C.UTF-8
ENV RAILS_ENV=development
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends build-essential chromium libyaml-dev nano
RUN apt-get install -yqq --no-install-recommends build-essential chromium less libyaml-dev nano netcat-traditional pkg-config
RUN gem install bundler
ARG BUNDLER_VERSION
RUN gem install bundler -v ${BUNDLER_VERSION}
RUN echo 'gem: --no-document' > /etc/gemrc
RUN useradd -u ${UID} --shell /bin/bash app
RUN mkdir -p /home/app && chown -R app:app /home/app
RUN chown -R app /usr/local/bundle
ARG UID
RUN useradd -u $UID --shell /bin/bash app
USER ${UID}
RUN mkdir -p /home/app && chown -R app:app /home/app
ARG RAILS_VERSION
ENV RAILS_VERSION=$RAILS_VERSION
ARG ACTIVEADMIN_VERSION
ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
WORKDIR /app
COPY . /app
RUN bundle install
RUN mkdir -p /app/spec/dummy/db && chown -R app:app /app/spec/dummy/db /usr/local/bundle
RUN ln -s /app/extra/.bashrc /home/app/.bashrc

6
extra/Dockerfile.dockerignore Обычный файл
Просмотреть файл

@@ -0,0 +1,6 @@
# Ignore everything but the required files for bundle install
/**/*
!/*.gemspec
!/Gemfile
!/lib

Просмотреть файл

@@ -1,18 +0,0 @@
FROM ruby:3.3-alpine
ARG UID
ENV DEVEL=1
ENV LANG=C.UTF-8
ENV RAILS_ENV=development
RUN apk update && apk add --no-cache build-base chromium tzdata yaml-dev
RUN gem install bundler
RUN echo 'gem: --no-document' > /etc/gemrc
RUN adduser -u ${UID} -D app
RUN mkdir -p /home/app && chown -R app:app /home/app
RUN chown -R app /usr/local/bundle
COPY . /app

Просмотреть файл

@@ -1,21 +0,0 @@
# Development
Overcommit can be used to ensure that Conventional commits are good.
## Releases
```sh
# Update version.rb with the new version
# Update the gemfiles:
bin/appraisal
```
## Testing
```sh
# Running specs using a specific configuration:
bin/appraisal rails60-activeadmin22 rspec
# Using latest activeadmin version:
bin/appraisal rails60-activeadmin rspec
# See gemfiles for more configurations
```

39
extra/development.md Обычный файл
Просмотреть файл

@@ -0,0 +1,39 @@
## Development
Overcommit can be used to ensure that Conventional commits are good.
### Dev setup
There 2 ways to interact with this project:
1) Using Docker:
```sh
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
make up
# Enter in a Rails console (with the dummy app started):
make console
# Enter in a shell (with the dummy app started):
make shell
# Run the linter on the project (with the dummy app started):
make lint
# Run the test suite (with the dummy app started):
make specs
# Remove container and image:
make cleanup
# To try different versions of Ruby/Rails/ActiveAdmin:
RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
# For more commands please check the Makefile
```
2) With a local setup:
```sh
# Dev setup (set the required envs):
source extra/dev_setup.sh
# Install dependencies:
bundle update
# Run server (or any command):
bin/rails s
# To try different versions of Rails/ActiveAdmin edit extra/dev_setup.sh
```

19
extra/docker-compose.yml Обычный файл
Просмотреть файл

@@ -0,0 +1,19 @@
services:
app:
build:
context: ..
dockerfile: extra/Dockerfile
args:
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
BUNDLER_VERSION: ${BUNDLER_VERSION}
RAILS_VERSION: ${RAILS:-}
RUBY_IMAGE: ruby:${RUBY:-3.4}-slim
UID: ${UID}
user: ${UID}:${GID}
ports:
- ${SERVER_PORT}:${SERVER_PORT}
working_dir: /app
volumes:
- ..:/app
stdin_open: true
tty: true

Просмотреть файл

@@ -1,8 +0,0 @@
echo "> Install dependencies"
rm -f Gemfile.lock && bundle install
echo "> Run pending migrations"
cd spec/dummy && bundle exec rails db:migrate
echo "> Start Rails server"
cd /app && rm -f spec/dummy/tmp/pids/server.pid && bundle exec rails s -b 0.0.0.0