-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
68 lines (51 loc) · 1.64 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
# Base image
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION
# Sets an environment variable with the bundle directory
ENV BUNDLE_PATH=/bundle
# Sets an argument variable with the application directory
ARG APP_HOME=/app
# Run security updates
RUN apt-get update && apt-get upgrade -y
# Install curl
RUN apt-get install -y curl
# Install PostgreSQL client and Geo libraries
RUN apt-get install -y postgresql-client libpq-dev
# The following are used to trim down the size of the image by removing unneeded data
RUN apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf \
/var/lib/apt \
/var/lib/dpkg \
/var/lib/cache \
/var/lib/log
# Install Bundler
ARG BUNDLER_VERSION=2.4.17
RUN gem install bundler -v $BUNDLER_VERSION --no-doc
# Update the system
RUN apt-get update -y
# Install Chromium for the feature tests
RUN apt-get install -y --no-install-recommends chromium
## Install gems in a separate Docker fs layer
WORKDIR /gems
COPY Gemfile Gemfile.lock ./
RUN bundle
## Node
ARG NODE_VERSION=18
RUN curl -fsSL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
RUN apt-get install -y nodejs
## Yarn
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn
## Install yarn dependencies in a separate Docker fs layer
WORKDIR /js
COPY package.json yarn.lock ./
RUN yarn install
WORKDIR /app
RUN groupadd -r app && \
useradd --no-log-init -r -g app -d /app app
USER app:app
COPY . .
# Sets an interactive shell as default command when the container starts
CMD ["/bin/sh"]