-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
62 lines (43 loc) · 1.57 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM ruby:3.0-alpine AS base
ENV APP_DIR="/srv/app" \
BUNDLE_PATH="/srv/bundler" \
BUILD_PACKAGES="build-base ruby-dev" \
APP_PACKAGES="bash tzdata shared-mime-info" \
APP_USER="app"
# Thes env var definitions reference values from the previous definitions, so
# they need to be split off on their own. Otherwise, they'll receive stale
# values because Docker will read the values once before it starts setting
# values.
ENV BUNDLE_BIN="${BUNDLE_PATH}/bin" \
BUNDLE_APP_CONFIG="${BUNDLE_PATH}" \
GEM_HOME="${BUNDLE_PATH}" \
RELEASE_PACKAGES="${APP_PACKAGES}"
ENV PATH="${APP_DIR}:${APP_DIR}/bin:${BUNDLE_BIN}:${PATH}"
RUN mkdir -p $APP_DIR $BUNDLE_PATH
WORKDIR $APP_DIR
FROM base as build
RUN apk add --no-cache \
--virtual app \
$APP_PACKAGES && \
apk add --no-cache \
--virtual build_deps \
$BUILD_PACKAGES
COPY Gemfile* $APP_DIR/
RUN bundle config --local without 'development test' && \
bundle install --jobs=4
COPY . $APP_DIR/
FROM build as development
RUN bundle config --local --delete without && \
bundle install --jobs=4
RUN wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh | sh
ENTRYPOINT ["bundle", "exec", "cloudtruth-importer"]
CMD ["--help"]
FROM base AS release
RUN apk add --no-cache \
--virtual app \
$RELEASE_PACKAGES
RUN wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh | sh
COPY --from=build $BUNDLE_PATH $BUNDLE_PATH
COPY --from=build $APP_DIR $APP_DIR
ENTRYPOINT ["bundle", "exec", "cloudtruth-importer"]
CMD ["--help"]