Skip to content

Commit

Permalink
update ruby to 2.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eitoball committed Apr 3, 2022
1 parent 358dbe3 commit 3f0bf3e
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 37 deletions.
61 changes: 36 additions & 25 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,56 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2
RUN /usr/bin/amazon-linux-extras install -y \
postgresql11 \
python3.8
RUN /usr/bin/yum install -y \
gcc \
gcc-c++ \
git \
make \
openssl-devel \
postgresql-devel \
rpm-build \
shadow-utils \
sudo \
util-linux \
xorg-x11-server-Xvfb \
zlib-devel

RUN /usr/bin/yum install -y deltarpm && \
/usr/bin/yum update -y && \
/usr/bin/yum install -y \
gcc \
gcc-c++ \
git \
libffi-devel \
libpq-devel \
make \
openssl-devel \
python38-devel \
readline-devel \
rpm-build \
shadow-utils \
sudo \
util-linux \
xorg-x11-server-Xvfb \
zlib-devel

RUN curl -sSL -o /tmp/dockerize.tgz https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \
tar -xzf /tmp/dockerize.tgz -C /usr/local/bin && \
rm /tmp/dockerize.tgz

RUN curl -sSL -o /tmp/ruby-2.7.5.tar.gz https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.gz \
&& tar -xzf /tmp/ruby-2.7.5.tar.gz \
&& cd ruby-2.7.5 \
&& ./configure \
&& make -j4 \
&& make install \
&& cd .. \
&& rm -rf ruby-2.7.5 /tmp/ruby-2.7.5.tar.gz

RUN curl -sLO https://rpm.nodesource.com/setup_14.x && \
bash setup_14.x && \
rm setup_14.x && \
yum install -y nodejs

RUN curl -sLO https://dl.yarnpkg.com/rpm/yarn.repo && \
mv yarn.repo /etc/yum.repos.d/ && \
yum install -y yarn

ADD ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

RUN rm /usr/bin/python && ln -s /usr/bin/python3.8 /usr/bin/python
RUN python3.8 -m pip install cryptography==3.3.2 awscli awsebcli

RUN /usr/sbin/adduser -m circleci&& usermod -aG wheel circleci
RUN /usr/bin/sed -i -e "s/^# %wheel/%wheel/" /etc/sudoers
# RUN /usr/sbin/adduser -m circleci&& usermod -aG wheel circleci
# RUN /usr/bin/sed -i -e "s/^# %wheel/%wheel/" /etc/sudoers

USER circleci
RUN git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ENV PATH /home/circleci/.rbenv/shims:/home/circleci/.rbenv/bin:/home/circleci/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN echo 'eval "$(rbenv init -)"' >> ~/.bash_profile && \
eval "$(rbenv init -)"
RUN rbenv install 2.7.5 && rbenv global 2.7.5
RUN sudo /usr/bin/pip3.8 install --upgrade pip
RUN sudo /usr/local/bin/pip3.8 install awscli awsebcli
# USER circleci

ENTRYPOINT ["/docker-entrypoint.sh"]
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
RAILS_ENV: test
AWS_DEFAULT_REGION: us-west-2
EB_APP_NAME: api
PYTHON_BIN: python3.8
- image: mdillon/postgis:11
environment:
POSTGRES_USER: safecast
Expand All @@ -19,15 +20,15 @@ jobs:
- checkout
- restore_cache:
keys:
- v4-safecastapi-{{ checksum "Gemfile.lock" }}
- v4-safecastapi-
- v5-safecastapi-{{ checksum "Gemfile.lock" }}
- v5-safecastapi-
- run:
name: Bundle Install
command: |
gem install bundler -v 2.2.29
bundle install --path vendor/bundle --jobs 2 --retry 3
- save_cache:
key: v4-safecastapi-{{ checksum "Gemfile.lock" }}
key: v5-safecastapi-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
Expand Down
Empty file modified .circleci/docker-entrypoint.sh
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion .elasticbeanstalk/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ PACKAGE="${VERSION}.zip"

cp config/database.yml.beanstalk config/database.yml

.elasticbeanstalk/package.py "${PACKAGE}"
PYTHON_BIN=${PYTHON_BIN:-python}

${PYTHON_BIN} .elasticbeanstalk/package.py "${PACKAGE}"

aws s3 cp --no-progress ".elasticbeanstalk/app_versions/${PACKAGE}" "s3://${S3_BUCKET_NAME}/${EB_APP_NAME}/"

Expand Down
8 changes: 8 additions & 0 deletions .platform/hooks/postdeploy/01_set_proxy_timeout_value.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

VISIBILITY_TIMEOUT=$(/opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig | jq -r .visibility_timeout)
if [ -n "$VISIBILITY_TIMEOUT" ]; then
echo "proxy_read_timeout ${VISIBILITY_TIMEOUT}s;" > /etc/nginx/conf.d/worker.conf
else
echo "proxy_read_timeout 600s;" > /etc/nginx/conf.d/web.conf
fi

This file was deleted.

3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7.5
FROM public.ecr.aws/docker/library/ruby:2.7.5

RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN curl -q https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
Expand All @@ -13,7 +13,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

WORKDIR /src
ADD Gemfile Gemfile.lock .ruby-version /src/
RUN gem install bundler -v 2.2.29 # Ruby 2.6 running on 64bit Amazon Linux 2/3.3.7
RUN bundle install --jobs=4 --retry=3

CMD [ "bundle", "exec", "rails", "server", "-b", "0.0.0.0" ]

0 comments on commit 3f0bf3e

Please sign in to comment.