-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
34 lines (21 loc) · 743 Bytes
/
Dockerfile
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
#Dockerfile
FROM ruby:2.7.2-alpine
LABEL version="1.0.0" maintainer="María Sanz Sánchez <[email protected]>"
#RUN apt-get update && apt-get install -y
# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
#Create a dedicated user for running test
RUN adduser -D my-test-user
#Gives ownership to our user
RUN chown my-test-user $GEM_HOME && chmod 777 $GEM_HOME
#Set the user for CMD
USER my-test-user
WORKDIR /home/my-test-user
COPY --chown=my-test-user Gemfile ./
COPY --chown=my-test-user Gemfile.lock ./
# Builds the application
RUN bundle install
RUN rm -r /home/my-test-user/Gemfile*
WORKDIR /test
# specifies what command to run within the container
CMD ["rake", "test"]