Skip to content

Dev: update setup #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .dockerignore

This file was deleted.

37 changes: 25 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
include extra/.env

help:
@echo "Main targets: build / specs / up / server / specs / shell"
@echo -e "${COMPOSE_PROJECT_NAME} - Main project commands:\n\
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)\n\
make specs # run the tests (after up)\n\
make lint # run the linters (after up)\n\
make server # run the server (after up)\n\
make shell # open a shell (after up)\n\
make down # cleanup (after up)\n\
Example: RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up"

# Docker commands
# System commands

build:
@rm -f Gemfile.lock
@rm -f Gemfile.lock spec/dummy/db/*.sqlite3
@docker compose -f extra/docker-compose.yml build

up: build
db_reset:
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:reset db:test:prepare

up: build db_reset
@docker compose -f extra/docker-compose.yml up

cleanup:
shell:
@docker compose -f extra/docker-compose.yml exec app bash

down:
@docker compose -f extra/docker-compose.yml down --volumes --rmi local --remove-orphans

# App commands

server:
@docker compose -f extra/docker-compose.yml exec app bin/rails s -b 0.0.0.0 -p ${SERVER_PORT}

specs:
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast
console:
@docker compose -f extra/docker-compose.yml exec app bin/rails console

lint:
@docker compose -f extra/docker-compose.yml exec app bin/rubocop

shell:
@docker compose -f extra/docker-compose.yml exec app bash
server:
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}

specs:
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast
4 changes: 2 additions & 2 deletions extra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV DEVEL=1
ENV LANG=C.UTF-8

RUN apt-get update -qq
RUN apt-get install -yqq --no-install-recommends build-essential chromium libyaml-dev nano netcat-traditional pkg-config
RUN apt-get install -yqq --no-install-recommends build-essential chromium less libyaml-dev nano netcat-traditional pkg-config

ARG BUNDLER_VERSION
RUN gem install bundler -v ${BUNDLER_VERSION}
Expand All @@ -26,6 +26,6 @@ ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
WORKDIR /app
COPY . /app
RUN bundle install
RUN chown -R app:app /app/spec/dummy/db /usr/local/bundle
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 changes: 6 additions & 0 deletions extra/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore everything but the required files for bundle install
/**/*

!/*.gemspec
!/Gemfile
!/lib
2 changes: 1 addition & 1 deletion extra/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export DEVEL=1

export RAILS_VERSION=8.0.2
export RAILS_VERSION=7.2.2.1
export ACTIVEADMIN_VERSION=3.3.0

export RAILS_ENV=development
16 changes: 2 additions & 14 deletions extra/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Dev setup

There 3 ways to interact with this project:
There are 2 ways to interact with this project:

1) Using Docker:

Expand All @@ -24,19 +24,7 @@ RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
# For more commands please check the Makefile
```

2) Using Appraisal:

```sh
export RAILS_ENV=development
# Install dependencies:
bin/appraisal
# Run server (or any command):
bin/appraisal rails s
# Or with a specific configuration:
bin/appraisal rails80-activeadmin rails s
```

3) With a local setup:
2) With a local setup:

```sh
# Dev setup (set the required envs):
Expand Down
1 change: 0 additions & 1 deletion extra/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ services:
- ..:/app
stdin_open: true
tty: true
command: ${COMMAND:-extra/init.sh}
7 changes: 0 additions & 7 deletions extra/init.sh

This file was deleted.