-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
55 lines (40 loc) · 1.25 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
# syntax = docker/dockerfile:1.4
ARG RUBY_VERSION=3.3.4
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
LABEL description="Alchemists Application"
LABEL maintainer="Brooke Kuhlmann <brooke@alchemists.io>"
WORKDIR /app
RUN <<STEPS
apt-get update -qq \
&& apt-get install --no-install-recommends -y curl libjemalloc2 \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
STEPS
ENV RACK_ENV=production
ENV HANAMI_ENV=production
ENV BUNDLE_DEPLOYMENT=1
ENV BUNDLE_PATH=/usr/local/bundle
ENV BUNDLE_WITHOUT="development:quality:test:tools"
FROM base AS build
RUN <<STEPS
apt-get update -qq \
&& apt-get install --no-install-recommends -y build-essential git pkg-config \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
STEPS
COPY .ruby-version Gemfile Gemfile.lock ./
RUN <<STEPS
bundle install
rm -rf "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
STEPS
COPY . .
FROM base
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /app /app
RUN <<STEPS
mkdir -p /app/log
mkdir -p /app/tmp
STEPS
RUN groupadd --system --gid 1000 app && \
useradd app --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R app:app log tmp
USER 1000:1000
ENTRYPOINT ["/app/bin/docker/entrypoint"]