Websites/Dockerfile

45 lines
1.4 KiB
Docker
Raw Permalink Normal View History

2024-06-29 07:17:46 +00:00
FROM ruby:3.2.2-alpine3.18 AS ruby-builder
2024-05-03 03:04:43 +00:00
RUN apk --no-cache add build-base cmake git glib-dev postgresql14-dev
COPY Gemfile Gemfile.lock ./
RUN gem i foreman && BUNDLE_IGNORE_CONFIG=true bundle install -j$(nproc) \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
2024-06-29 07:17:46 +00:00
FROM node:18-alpine3.18 AS node-builder
2024-05-03 03:04:43 +00:00
RUN apk --no-cache add git
WORKDIR /app
COPY package.json yarn.lock ./
RUN corepack enable && corepack prepare --activate && yarn install
RUN corepack install -g pnpm
FROM ruby:3.2.2-alpine3.18
RUN apk --no-cache add ffmpeg vips gifsicle \
postgresql14-client \
git git-lfs jemalloc tzdata \
openssh-keygen
2024-05-03 03:04:43 +00:00
WORKDIR /app
RUN git config --global --add safe.directory $(pwd)
ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
ENV RUBY_YJIT_ENABLE=1
# Setup node and yarn
COPY --from=node-builder /usr/lib /usr/lib
COPY --from=node-builder /usr/local/share /usr/local/share
COPY --from=node-builder /usr/local/lib /usr/local/lib
COPY --from=node-builder /usr/local/include /usr/local/include
COPY --from=node-builder /usr/local/bin /usr/local/bin
COPY --from=node-builder /root/.cache/node /root/.cache/node
# Copy gems and js packages
COPY --from=node-builder /app/node_modules node_modules
COPY --from=ruby-builder /usr/local/bundle /usr/local/bundle
CMD ["foreman", "start", "-f", "Procfile.dev"]