forked from mayu-live/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (39 loc) · 1.58 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
# syntax = docker/dockerfile:experimental
ARG RUBY_VERSION=3.1.2
ARG VARIANT=jemalloc-slim
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base
ARG BUNDLER_VERSION=2.3.11
ARG BUNDLE_WITHOUT=development:test
ARG BUNDLE_PATH=vendor/bundle
ENV BUNDLE_PATH ${BUNDLE_PATH}
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
SHELL ["/bin/bash", "-c"]
RUN mkdir /app
WORKDIR /app
RUN mkdir -p tmp/pids
#######################################################
FROM base as build
ENV DEV_PACKAGES git build-essential wget vim curl gzip xz-utils nodejs npm
RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \
apt-get update -qq && \
apt-get install --no-install-recommends -y ${DEV_PACKAGES} \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
RUN gem install -N bundler -v ${BUNDLER_VERSION}
COPY Gemfile* ./
RUN bundle install && rm -rf vendor/bundle/ruby/*/cache
COPY . .
RUN cd lib/mayu/client && npm install && npm run build:production && rm -r node_modules
#######################################################
FROM base
ENV PACKAGES postgresql-client file vim curl gzip
RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt \
apt-get update -qq && \
apt-get install --no-install-recommends -y \
${PACKAGES} \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
COPY --from=build /app /app
ENV PORT 3000
WORKDIR /app/example
CMD ["bundle", "exec", "falcon", "host"]