Skip to content

Commit

Permalink
Merge pull request #813 from zmariscal/feature--add-dockerfile-and-co…
Browse files Browse the repository at this point in the history
…mpose-file

Feature:  Add Dockerfile and compose file
  • Loading branch information
jkowens committed Sep 4, 2023
2 parents 2be5c18 + b5b77e4 commit 02838d1
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official Ruby 3.2 image as a base image
ARG RUBY_VERSION=3.2
FROM ruby:${RUBY_VERSION}-bullseye

# Set the working directory
WORKDIR /usr/src/app

# Install system packages
RUN apt-get update -qq && \
apt-get install -y default-mysql-client vim && \
apt-get clean

# Set environment variables
ENV AR_VERSION=7.0

# Copy all files
COPY . .

# Move sample database.yml and install gems
RUN mv test/database.yml.sample test/database.yml && \
bundle install

CMD ["irb"]
13 changes: 13 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,19 @@ AR_VERSION=7.0 bundle exec rake test:postgresql test:sqlite3 test:mysql2

Once you have pushed up your changes, you can find your CI results [here](https://github.com/zdennis/activerecord-import/actions).

#### Docker Setup

Before you begin, make sure you have [Docker](https://www.docker.com/products/docker-desktop/) and [Docker Compose](https://docs.docker.com/compose/) installed on your machine. If you don't, you can install both via Homebrew using the following command:

```bash
brew install docker && brew install docker-compose
```
##### Steps

1. In your terminal run `docker-compose up --build`
1. In another tab/window run `docker-compose exec app bash`
1. In that same terminal run the mysql2 test by running `bundle exec rake test:mysql2`

## Issue Triage [![Open Source Helpers](https://www.codetriage.com/zdennis/activerecord-import/badges/users.svg)](https://www.codetriage.com/zdennis/activerecord-import)

You can triage issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to activerecord-import on CodeTriage](https://www.codetriage.com/zdennis/activerecord-import).
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.5"

services:
mysql:
platform: linux/x86_64
image: mysql:5.7
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"

app:
build:
context: .
environment:
DB_HOST: mysql
AR_VERSION: 7.0
volumes:
- .:/usr/src/app
depends_on:
- mysql
command: tail -f /dev/null

volumes:
mysql-data:
1 change: 1 addition & 0 deletions test/database.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ common: &common
mysql2: &mysql2
<<: *common
adapter: mysql2
host: mysql

mysql2spatial:
<<: *mysql2
Expand Down

0 comments on commit 02838d1

Please sign in to comment.