forked from open-telemetry/opentelemetry-ruby-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
81 lines (68 loc) · 1.68 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Configuration for Ruby base image
ARG ALPINE_VERSION=3.10
ARG RUBY_VERSION=2.6.5
FROM ruby:"${RUBY_VERSION}-alpine${ALPINE_VERSION}" as ruby
# Metadata
LABEL maintainer="open-telemetry/opentelemetry-ruby-contrib"
# User and Group for app isolation
ARG APP_UID=1000
ARG APP_USER=app
ARG APP_GID=1000
ARG APP_GROUP=app
ARG APP_DIR=/app
# Rubygems Bundler version
ARG BUNDLER_VERSION=2.0.2
ENV SHELL /bin/bash
ARG PACKAGES="\
autoconf \
automake \
bash \
binutils \
build-base \
coreutils \
execline \
findutils \
git \
grep \
less \
libstdc++ \
libtool \
libxml2-dev \
libxslt-dev \
mariadb-dev \
openssl \
postgresql-dev \
tzdata \
util-linux \
"
# Install packages
RUN apk update && \
apk upgrade && \
apk add --no-cache ${PACKAGES}
# Configure Bundler and PATH
ENV LANG=C.UTF-8 \
GEM_HOME=/bundle \
BUNDLE_JOBS=20 \
BUNDLE_RETRY=3
ENV BUNDLE_PATH $GEM_HOME
ENV BUNDLE_APP_CONFIG="${BUNDLE_PATH}" \
BUNDLE_BIN="${BUNDLE_PATH}/bin" \
BUNDLE_GEMFILE=Gemfile
ENV PATH "${APP_DIR}/bin:${BUNDLE_BIN}:${PATH}"
# Upgrade RubyGems and install required Bundler version
RUN gem update --system && \
gem install "bundler:${BUNDLER_VERSION}" && \
gem cleanup
# Add custom app User and Group
RUN addgroup -S -g "${APP_GID}" "${APP_GROUP}" && \
adduser -S -g "${APP_GROUP}" -u "${APP_UID}" "${APP_USER}"
# Create directories for the app code
RUN mkdir -p "${APP_DIR}" \
"${APP_DIR}/tmp" && \
chown -R "${APP_USER}":"${APP_GROUP}" "${APP_DIR}" \
"${APP_DIR}/tmp" \
"${BUNDLE_PATH}/"
USER "${APP_USER}"
WORKDIR "${APP_DIR}"
# Commands will be supplied via `docker-compose`
CMD []