Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aabae85
commit 58bec40
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
ARG RUBY_VERSION | ||
|
||
FROM ruby:${RUBY_VERSION}-slim | ||
|
||
ARG GROUPNAME=docker | ||
ARG USERNAME=docker | ||
ARG UID | ||
ARG GID | ||
ARG RUNTIME_PACKAGES="git less" | ||
ARG BUILD_PACKAGES="build-essential" | ||
ARG WORKSPACE_DIR=/workspace | ||
ARG WORKSPACE_CONTAINER_DIR=/workspace-container | ||
|
||
RUN set -x \ | ||
&& groupadd -g ${GID} ${GROUPNAME} \ | ||
&& useradd -u ${UID} -g ${GROUPNAME} -m ${USERNAME} | ||
|
||
RUN set -x \ | ||
&& apt-get -y update \ | ||
&& apt-get -y upgrade \ | ||
&& apt-get -y install --no-install-recommends ${RUNTIME_PACKAGES} ${BUILD_PACKAGES} | ||
|
||
RUN set -x \ | ||
&& mkdir -p ${WORKSPACE_DIR} \ | ||
&& chown -R ${UID}:${GID} ${WORKSPACE_DIR} | ||
WORKDIR ${WORKSPACE_DIR} | ||
|
||
RUN set -x \ | ||
&& mkdir -p ${WORKSPACE_CONTAINER_DIR} \ | ||
&& chown -R ${UID}:${GID} ${WORKSPACE_CONTAINER_DIR} | ||
|
||
COPY --chown=${UID}:${GID} . . | ||
|
||
USER ${UID} | ||
|
||
RUN set -x \ | ||
&& gem install bundler \ | ||
&& bundle config path ${WORKSPACE_CONTAINER_DIR}/vendor/bundle \ | ||
&& bundle install \ | ||
&& mv Gemfile.lock ${WORKSPACE_CONTAINER_DIR} | ||
|
||
ENV WORKSPACE_CONTAINER_DIR=${WORKSPACE_CONTAINER_DIR} | ||
ENTRYPOINT ["/workspace/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
x-base: | ||
base: &base | ||
build: &build | ||
context: . | ||
args: &build-args | ||
UID: 1000 | ||
GID: 1000 | ||
volumes: | ||
- .:/workspace | ||
|
||
services: | ||
"3.1": | ||
<<: *base | ||
image: rspec-context_helper.rb:3.1 | ||
build: | ||
<<: *build | ||
args: | ||
<<: *build-args | ||
RUBY_VERSION: 3.1 | ||
|
||
"3.0": | ||
<<: *base | ||
image: rspec-context_helper.rb:3.0 | ||
build: | ||
<<: *build | ||
args: | ||
<<: *build-args | ||
RUBY_VERSION: 3.0 | ||
|
||
"2.7": | ||
<<: *base | ||
image: rspec-context_helper.rb:2.7 | ||
build: | ||
<<: *build | ||
args: | ||
<<: *build-args | ||
RUBY_VERSION: 2.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
cleanup() { | ||
rm Gemfile.lock | ||
} | ||
trap cleanup EXIT | ||
|
||
ln -sf ${WORKSPACE_CONTAINER_DIR}/Gemfile.lock . | ||
$@ |