forked from dwango/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from best-friends/improve-docker-build
Use original dockerfile
- Loading branch information
Showing
3 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ elasticsearch | |
npm-debug.log | ||
yarn-error.log | ||
yarn-debug.log | ||
/spec | ||
/dist | ||
/nanobox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# syntax = docker/dockerfile:experimental | ||
|
||
ARG DEBIAN_RELEASE=stretch | ||
ARG NODE_VERSION=8.15.1 | ||
ARG RUBY_VERSION=2.6.1 | ||
|
||
FROM node:${NODE_VERSION}-${DEBIAN_RELEASE}-slim as node | ||
|
||
FROM ruby:${RUBY_VERSION}-slim-${DEBIAN_RELEASE} | ||
|
||
COPY --from=node /usr/local/ /usr/local/ | ||
|
||
ARG UID=991 | ||
ARG GID=991 | ||
|
||
RUN \ | ||
apt update && \ | ||
echo "Etc/UTC" > /etc/localtime && \ | ||
apt dist-upgrade -y && \ | ||
apt install -y \ | ||
build-essential \ | ||
git \ | ||
libicu-dev \ | ||
libidn11-dev \ | ||
libpq-dev \ | ||
libprotobuf-dev \ | ||
protobuf-compiler \ | ||
&& \ | ||
apt install -y --no-install-recommends \ | ||
bison \ | ||
bzip2 \ | ||
ca-certificates \ | ||
ffmpeg \ | ||
file \ | ||
git \ | ||
imagemagick \ | ||
libffi-dev \ | ||
libgdbm-dev \ | ||
libgdbm3 \ | ||
libgmp-dev \ | ||
libicu-dev \ | ||
libidn11 \ | ||
libidn11-dev \ | ||
libncurses5-dev \ | ||
libpq-dev \ | ||
libpq5 \ | ||
libprotobuf-dev \ | ||
libprotobuf10 \ | ||
libreadline-dev \ | ||
libreadline7 \ | ||
libssl-dev \ | ||
libssl1.1 \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
libyaml-0-2 \ | ||
libyaml-dev \ | ||
procps \ | ||
protobuf-compiler \ | ||
tzdata \ | ||
whois \ | ||
zlib1g-dev \ | ||
&& \ | ||
gem install --no-document bundler && \ | ||
rm /usr/local/bin/yarn /usr/local/bin/yarnpkg && \ | ||
npm install --global --force yarn && \ | ||
addgroup --gid $GID mastodon && \ | ||
useradd -m -u $UID -g $GID -d /opt/mastodon mastodon && \ | ||
echo "mastodon:`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 | mkpasswd -s -m sha-256`" | chpasswd && \ | ||
mkdir -p /opt/mastodon && \ | ||
chown mastodon:mastodon /opt/mastodon | ||
|
||
WORKDIR /opt/mastodon | ||
|
||
USER mastodon | ||
|
||
ADD --chown=mastodon:mastodon Gemfile* /opt/mastodon/ | ||
|
||
RUN \ | ||
bundle config build.nokogiri --use-system-libraries && \ | ||
bundle install -j$(nproc) --deployment --without development test | ||
|
||
ADD --chown=mastodon:mastodon package.json yarn.lock .yarnclean /opt/mastodon/ | ||
|
||
RUN \ | ||
yarn install --pure-lockfile && \ | ||
yarn cache clean | ||
|
||
COPY --chown=mastodon:mastodon . /opt/mastodon | ||
|
||
ENV RAILS_ENV=production | ||
ENV NODE_ENV=production | ||
ENV PATH=/opt/mastodon/bin:$PATH | ||
|
||
RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile |