Skip to content

Instantly share code, notes, and snippets.

@iiewad
Created January 8, 2025 02:05
Show Gist options
  • Save iiewad/3019c1ad790e9a9596d62f2828389d3c to your computer and use it in GitHub Desktop.
Save iiewad/3019c1ad790e9a9596d62f2828389d3c to your computer and use it in GitHub Desktop.
Because I can't install ruby 2.3.8 version on M1 macbook, So I try to use docker build the dev env.
version: '3.8'
services:
redis:
image: redis
ports:
- "6379:6379"
api:
build: .
ports:
- "3000:3000"
volumes:
- '.:/home/app'
depends_on:
- redis
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- DATA_REGION=US
command: bin/rails server -p 3000 -b 0.0.0.0
stdin_open: true
tty: true
sidekiq:
build: .
depends_on:
- redis
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- DATA_REGION=US
volumes:
- '.:/home/app'
command: bundle exec sidekiq --index 0 --pidfile /var/run/sidekiq.pid -v -C config/sidekiq.yml
stdin_open: true
tty: true
FROM ruby:2.3
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
RUN apt-get update && \
apt install -y --only-upgrade --no-install-recommends ca-certificates debian-archive-keyring && \
apt-get install -y --no-install-recommends \
unzip zip \
libmagick++-dev libmariadb-client-lgpl-dev libpcap-dev libssl-dev nodejs vim htop cron ghostscript && \
rm -rf /var/lib/apt/lists/*
RUN gem install rack -v '~> 1.6' && \
gem install passenger -v 6.0.22
ENV APP_HOME /home/app
RUN mkdir -p $APP_HOME
RUN mkdir -p /tmp/access
ADD Gemfile $APP_HOME/Gemfile
ADD Gemfile.lock $APP_HOME/Gemfile.lock
RUN cd $APP_HOME && bundle install # --without development test # --deployment
ADD . $APP_HOME
WORKDIR $APP_HOME
EXPOSE 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment