File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on :
4
+ pull_request :
5
+ branches : [ "main" ]
6
+ push :
7
+ branches : [ "main" ]
8
+
9
+ jobs :
10
+ docker-build :
11
+ runs-on : ubuntu-24.04
12
+ env :
13
+ DOCKER_REPO : ghcr.io/${{ github.repository }}
14
+ RUBY_VERSION : 3.4.4
15
+ NODE_VERSION : 22.16.0
16
+ steps :
17
+ - uses : actions/checkout@v4
18
+ - name : Build Docker image
19
+ run : ./build.sh
20
+ - name : Login to the container registry
21
+ uses : docker/login-action@v2
22
+ with :
23
+ registry : ${{ env.DOCKER_REPO }}
24
+ username : ${{ github.actor }}
25
+ password : ${{ secrets.GITHUB_TOKEN }}
26
+ if : github.event_name == 'push'
27
+ - name : Push Docker image
28
+ run : ./push.sh
29
+ if : github.event_name == 'push'
Original file line number Diff line number Diff line change
1
+ # This Dockerfile is designed for running the CI of Ruby on Rails projects
2
+ ARG RUBY_VERSION=3.4.4
3
+ FROM docker.io/library/ruby:$RUBY_VERSION
4
+
5
+ RUN apt-get update -qq && \
6
+ apt-get install --no-install-recommends -y postgresql-client libjemalloc2 && \
7
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
8
+
9
+ # Install yarn and node
10
+ ARG NODE_VERSION=22.14.0
11
+ ARG YARN_VERSION=1.22.22
12
+ ENV PATH=/usr/local/node/bin:$PATH
13
+ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
14
+ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
15
+ npm install -g yarn@$YARN_VERSION && \
16
+ rm -rf /tmp/node-build-master
17
+
18
+ ENV RAILS_ENV="test"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ if [ -z " ${RUBY_VERSION:- } " ]; then
6
+ echo " RUBY_VERSION is not set"
7
+ exit 1
8
+ fi
9
+
10
+ if [ -z " ${NODE_VERSION:- } " ]; then
11
+ echo " NODE_VERSION is not set"
12
+ exit 1
13
+ fi
14
+
15
+ docker build --build-arg RUBY_VERSION=" $RUBY_VERSION " --build-arg NODE_VERSION=" $NODE_VERSION " -t " ${DOCKER_REPO} :ruby-${RUBY_VERSION} -node-${NODE_VERSION} " .
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ if [ -z " ${RUBY_VERSION:- } " ]; then
6
+ echo " RUBY_VERSION is not set"
7
+ exit 1
8
+ fi
9
+
10
+ if [ -z " ${NODE_VERSION:- } " ]; then
11
+ echo " NODE_VERSION is not set"
12
+ exit 1
13
+ fi
14
+
15
+ docker push " ${DOCKER_REPO} :ruby-${RUBY_VERSION} -node-${NODE_VERSION} "
You can’t perform that action at this time.
0 commit comments