-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.development
50 lines (37 loc) · 1.5 KB
/
Dockerfile.development
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
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.4
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
WORKDIR /rails
# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install -qq --no-install-recommends -y build-essential libjemalloc2 curl git libpq-dev libvips node-gyp pkg-config python-is-python3 postgresql-client ffmpeg yt-dlp
# Set the environment variable to use jemalloc
ENV LD_PRELOAD="libjemalloc.so.2" \
MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true,stats_print:false"
# Install JavaScript dependencies
ARG NODE_VERSION=20.11.1
ARG YARN_VERSION=latest
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
npm install -g yarn@$YARN_VERSION && \
rm -rf /tmp/node-build-master && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Throw-away build stage to reduce size of final image
FROM base as build
# Copy application code
COPY . .
# Bundle install
RUN bundle install
# Install node modules
COPY package* yarn* ./
RUN yarn install
# Hard set bin permissions
RUN chmod +x ./bin/*
# Entrypoint prepares the database.
ENTRYPOINT ["./bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/dev"]