-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.test
37 lines (28 loc) · 1.42 KB
/
Dockerfile.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ruby:3.2.2
# Setup the buildkite-agent user/group
RUN groupadd -r buildkite-agent && \
useradd -u 9999 -r -g buildkite-agent buildkite-agent && \
mkdir -p /home/buildkite-agent
# Setup the work directory where the application will live
ENV APP_HOME /var/www
WORKDIR $APP_HOME
# Setup bundler options to install gems in the work directory and use our gem mirror
RUN gem install bundler && \
bundle config --local app_config /usr/local/bundle/config && \
bundle config --local path vendor/bundle && \
bundle config --local "mirror.https://rubygems.org" "https://gemstash.zp-int.com" && \
mkdir /home/buildkite-agent/.gem # This is needed for publishing gems from inside your container
# RAILS APP: Add Gemfile and Gemfile.lock to the work directory
COPY Gemfile* $APP_HOME/
# LIBRARY: Add Gemfile, Gemfile.lock, and gemspec to the work directory
COPY Gemfile* deprecation_helper.gemspec $APP_HOME/
# Run bundle install with minimal dependencies
RUN bundle install
# Add the rest of the source, now that dependencies are installed
COPY . $APP_HOME
# Change the owner of the relevant directories to the buildkite-agent
RUN chown -R buildkite-agent:buildkite-agent /home/buildkite-agent && \
chown -R buildkite-agent:buildkite-agent $APP_HOME && \
chown -R buildkite-agent:buildkite-agent /usr/local/bundle/config
# Setup the container to run as the buildkite-agent user
USER buildkite-agent