-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
40 lines (31 loc) · 1.24 KB
/
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
35
36
37
38
39
40
FROM ruby:2.6
EXPOSE 4567
RUN apt-get update && apt-get install -y git
RUN apt-get install -y nodejs --force-yes
# Init variables
ARG BRANCH=""
ARG REVISION=""
ARG BUILD_TIME=""
ARG BUILD_NUMBER=""
ARG APP_HOME=""
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/
COPY version.json /usr/src/app/
#Specify bundler version to prevent Windows build error
ENV BUNDLER_VERSION='1.17.3'
COPY Rakefile /usr/src/app/
WORKDIR /usr/src/app
RUN gem install bundler -v 2.3.26
RUN bundle install
COPY . /usr/src/app
# Copy version file to source folder
RUN cp /usr/src/app/version.json /usr/src/app/source/
# Set values read from command line arguments
RUN if [ -z "$BRANCH" ] || [ "$BRANCH" = "dev portal" ]; then sed -i 's|BRANCH|production|g' /usr/src/app/source/version.json; else sed -i 's|BRANCH|'${BRANCH}'|g' /usr/src/app/source/version.json; fi
RUN sed -i 's|REVISION|'${REVISION}'|g' /usr/src/app/source/version.json
RUN sed -i 's|BUILD_TIME|'${BUILD_TIME}'|g' /usr/src/app/source/version.json
RUN sed -i 's|BUILD_NUMBER|'${BUILD_NUMBER}'|g' /usr/src/app/source/version.json
ENTRYPOINT ["rake"]
CMD ["dev"]
# 1) Build: docker build -t devbamboracom .
# 2) Run: docker run -v `pwd`/source:/usr/src/app/source -w /usr/src/app -p 4567:4567 devbamboracom