-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (30 loc) · 1 KB
/
Dockerfile
File metadata and controls
37 lines (30 loc) · 1 KB
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
ARG RUBY_VERSION=3.4.8
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# The app lives here
WORKDIR /app
# Install base packages
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
curl \
postgresql-client \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Non-root user for runtime stages (USER not set here so build stage keeps root)
RUN useradd --system --uid 1000 app && chown app:app /app
# Set production environment
ENV BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_CACHE_PATH="/usr/local/bundle/cache" \
BUNDLE_WITHOUT="development"
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build gems
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
build-essential \
git \
libpq-dev \
libyaml-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
# This can be overwritten at runtime
CMD ["ruby", "-v"]