mirror of
https://git.cloudron.io/cloudron/mastodon-app.git
synced 2024-11-21 23:31:00 +00:00
Dockerfile refactored, tests updated, tests dependencies updated
This commit is contained in:
parent
8a34a7093e
commit
d7dcfc832d
4 changed files with 210 additions and 21 deletions
210
Dockerfile
210
Dockerfile
|
@ -1,4 +1,10 @@
|
|||
FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
|
||||
ARG MASTODON_VERSION=4.3.0
|
||||
ARG MASTODON_VERSION_PRERELEASE=""
|
||||
ARG MASTODON_VERSION_METADATA=""
|
||||
|
||||
FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4 as build
|
||||
|
||||
ARG MASTODON_VERSION
|
||||
|
||||
RUN mkdir -p /app/code /app/pkg
|
||||
WORKDIR /app/code
|
||||
|
@ -9,17 +15,98 @@ RUN apt-get update && \
|
|||
bison build-essential libssl-dev libyaml-dev libreadline6-dev \
|
||||
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \
|
||||
nginx redis-server redis-tools postgresql postgresql-contrib \
|
||||
libidn11-dev libicu-dev libjemalloc-dev && \
|
||||
rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
libidn11-dev libicu-dev libjemalloc-dev libjemalloc2 patchelf
|
||||
|
||||
# install rbenv since we need ruby 3.2.3
|
||||
RUN mkdir -p /usr/local/rbenv && curl -LSs "https://github.com/rbenv/rbenv/archive/refs/tags/v1.2.0.tar.gz" | tar -xz -C /usr/local/rbenv --strip-components 1 -f -
|
||||
# Install build tools and bundler dependencies from APT
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
automake \
|
||||
libgdbm-dev \
|
||||
libglib2.0-dev \
|
||||
libgmp-dev \
|
||||
libicu-dev \
|
||||
libidn-dev \
|
||||
libpq-dev \
|
||||
libssl-dev \
|
||||
libtool \
|
||||
meson \
|
||||
nasm \
|
||||
pkg-config \
|
||||
shared-mime-info \
|
||||
xz-utils \
|
||||
# libvips components
|
||||
libcgif-dev \
|
||||
libexif-dev \
|
||||
libexpat1-dev \
|
||||
libgirepository1.0-dev \
|
||||
libheif-dev \
|
||||
libimagequant-dev \
|
||||
libjpeg-turbo8-dev \
|
||||
liblcms2-dev \
|
||||
liborc-dev \
|
||||
libpng-dev \
|
||||
libtiff-dev \
|
||||
libwebp-dev \
|
||||
# ffmpeg components
|
||||
libdav1d-dev \
|
||||
liblzma-dev \
|
||||
libmp3lame-dev \
|
||||
libopus-dev \
|
||||
libsnappy-dev \
|
||||
libvorbis-dev \
|
||||
libvpx-dev \
|
||||
libx264-dev \
|
||||
libx265-dev
|
||||
|
||||
# Apt update install non-dev versions of necessary components
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
libexpat1 \
|
||||
libglib2.0-0 \
|
||||
libicu70 \
|
||||
libidn12 \
|
||||
libpq5 \
|
||||
libreadline8 \
|
||||
libssl3 \
|
||||
libyaml-0-2 \
|
||||
# libvips components
|
||||
libcgif0 \
|
||||
libexif12 \
|
||||
libheif1 \
|
||||
libimagequant0 \
|
||||
libjpeg62 \
|
||||
libjpeg-turbo8 \
|
||||
liblcms2-2 \
|
||||
liborc-0.4-0 \
|
||||
libpng16-16 \
|
||||
libtiff5 \
|
||||
libwebp7 \
|
||||
libwebpdemux2 \
|
||||
libwebpmux3 \
|
||||
# ffmpeg components
|
||||
libdav1d5 \
|
||||
libmp3lame0 \
|
||||
libopencore-amrnb0 \
|
||||
libopencore-amrwb0 \
|
||||
libopus0 \
|
||||
libsnappy1v5 \
|
||||
libtheora0 \
|
||||
libvorbis0a \
|
||||
libvorbisenc2 \
|
||||
libvorbisfile3 \
|
||||
libvpx7 \
|
||||
libx264-163 \
|
||||
libx265-199
|
||||
|
||||
RUN rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
|
||||
# install rbenv since we need ruby 3.3.5
|
||||
RUN mkdir -p /usr/local/rbenv && curl -LSs "https://github.com/rbenv/rbenv/archive/refs/tags/v1.3.0.tar.gz" | tar -xz -C /usr/local/rbenv --strip-components 1 -f -
|
||||
ENV PATH /usr/local/rbenv/bin:$PATH
|
||||
ENV RBENV_ROOT /home/cloudron/rbenv
|
||||
RUN mkdir -p "$(rbenv root)"/plugins/ruby-build && curl -LSs "https://github.com/rbenv/ruby-build/archive/refs/tags/v20240530.1.tar.gz" | tar -xz -C "$(rbenv root)"/plugins/ruby-build --strip-components 1 -f -
|
||||
RUN mkdir -p "$(rbenv root)"/plugins/ruby-build && curl -LSs "https://github.com/rbenv/ruby-build/archive/refs/tags/v20241007.tar.gz" | tar -xz -C "$(rbenv root)"/plugins/ruby-build --strip-components 1 -f -
|
||||
|
||||
# install specific ruby version (https://github.com/mastodon/mastodon/blob/main/Dockerfile)
|
||||
ARG RUBY_VERSION=3.2.3
|
||||
ARG RUBY_VERSION=3.3.5
|
||||
RUN rbenv install ${RUBY_VERSION}
|
||||
ENV PATH ${RBENV_ROOT}/versions/${RUBY_VERSION}/bin:$PATH
|
||||
RUN gem install --no-document bundler
|
||||
|
@ -29,15 +116,102 @@ RUN mkdir -p /usr/local/node-${NODE_VERSION} && \
|
|||
curl -L https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz | tar zxf - --strip-components 1 -C /usr/local/node-${NODE_VERSION}
|
||||
ENV PATH /usr/local/node-${NODE_VERSION}/bin:$PATH
|
||||
|
||||
# Create temporary libvips specific build layer from build layer
|
||||
FROM build AS libvips
|
||||
|
||||
# libvips version
|
||||
ARG VIPS_VERSION=8.15.3
|
||||
# libvips download URL
|
||||
ARG VIPS_URL=https://github.com/libvips/libvips/releases/download
|
||||
|
||||
RUN mkdir -p /usr/local/libvips/src
|
||||
# Download and extract libvips source code
|
||||
RUN curl -L ${VIPS_URL}/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.xz | tar xJ --strip-components 1 -C /usr/local/libvips/src/
|
||||
|
||||
WORKDIR /usr/local/libvips/src
|
||||
|
||||
# Configure and compile libvips
|
||||
RUN meson setup build --prefix /usr/local/libvips --libdir=lib -Ddeprecated=false -Dintrospection=disabled -Dmodules=disabled -Dexamples=false
|
||||
RUN cd build && ninja && ninja install
|
||||
|
||||
# Create temporary ffmpeg specific build layer from build layer
|
||||
FROM build AS ffmpeg
|
||||
|
||||
# ffmpeg version
|
||||
ARG FFMPEG_VERSION=7.1
|
||||
# ffmpeg download URL
|
||||
ARG FFMPEG_URL=https://ffmpeg.org/releases
|
||||
|
||||
RUN mkdir -p /usr/local/ffmpeg/src
|
||||
# Download and extract ffmpeg source code
|
||||
RUN curl -L ${FFMPEG_URL}/ffmpeg-${FFMPEG_VERSION}.tar.xz | tar xJ --strip-components 1 -C /usr/local/ffmpeg/src/
|
||||
|
||||
WORKDIR /usr/local/ffmpeg/src
|
||||
|
||||
# Configure and compile ffmpeg
|
||||
RUN ./configure \
|
||||
--prefix=/usr/local/ffmpeg \
|
||||
--toolchain=hardened \
|
||||
--disable-debug \
|
||||
--disable-devices \
|
||||
--disable-doc \
|
||||
--disable-ffplay \
|
||||
--disable-network \
|
||||
--disable-static \
|
||||
--enable-ffmpeg \
|
||||
--enable-ffprobe \
|
||||
--enable-gpl \
|
||||
--enable-libdav1d \
|
||||
--enable-libmp3lame \
|
||||
--enable-libopus \
|
||||
--enable-libsnappy \
|
||||
--enable-libvorbis \
|
||||
--enable-libvpx \
|
||||
--enable-libwebp \
|
||||
--enable-libx264 \
|
||||
--enable-libx265 \
|
||||
--enable-shared \
|
||||
--enable-version3 && \
|
||||
make -j$(nproc) && \
|
||||
make install
|
||||
|
||||
FROM build
|
||||
|
||||
ENV RAILS_ENV production
|
||||
ENV NODE_ENV production
|
||||
ARG RAILS_SERVE_STATIC_FILES="true"
|
||||
ARG RUBY_YJIT_ENABLE="1"
|
||||
|
||||
# will install yarn
|
||||
RUN corepack enable
|
||||
ENV \
|
||||
MASTODON_VERSION=${MASTODON_VERSION} \
|
||||
# Apply Mastodon version information
|
||||
MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \
|
||||
MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" \
|
||||
# Apply Mastodon static files and YJIT options
|
||||
RAILS_SERVE_STATIC_FILES=${RAILS_SERVE_STATIC_FILES} \
|
||||
RUBY_YJIT_ENABLE=${RUBY_YJIT_ENABLE} \
|
||||
# Optimize jemalloc 5.x performance
|
||||
MALLOC_CONF="narenas:2,background_thread:true,thp:never,dirty_decay_ms:1000,muzzy_decay_ms:0" \
|
||||
# Enable libvips, should not be changed
|
||||
MASTODON_USE_LIBVIPS=true \
|
||||
# Sidekiq will touch tmp/sidekiq_process_has_started_and_will_begin_processing_jobs to indicate it is ready. This can be used for a readiness check in Kubernetes
|
||||
MASTODON_SIDEKIQ_READY_FILENAME=sidekiq_process_has_started_and_will_begin_processing_jobs
|
||||
|
||||
# Copy libvips components to layer
|
||||
COPY --from=libvips /usr/local/libvips/bin /usr/local/bin
|
||||
COPY --from=libvips /usr/local/libvips/lib /usr/local/lib
|
||||
|
||||
# Copy ffpmeg components to layer
|
||||
COPY --from=ffmpeg /usr/local/ffmpeg/bin /usr/local/bin
|
||||
COPY --from=ffmpeg /usr/local/ffmpeg/lib /usr/local/lib
|
||||
|
||||
RUN ldconfig && \
|
||||
# Smoketest media processors
|
||||
vips -v && \
|
||||
ffmpeg -version && \
|
||||
ffprobe -version
|
||||
|
||||
# renovate: datasource=github-releases depName=tootsuite/mastodon versioning=semver extractVersion=^v(?<version>.+)$
|
||||
ARG MASTODON_VERSION=4.3.0
|
||||
|
||||
RUN curl -L https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.tar.gz | tar -xz --strip-components 1 -f - && \
|
||||
bundle config --local set deployment 'true' && \
|
||||
bundle config --local set without 'development test' && \
|
||||
|
@ -45,8 +219,22 @@ RUN curl -L https://github.com/tootsuite/mastodon/archive/v${MASTODON_VERSION}.t
|
|||
bundle install && \
|
||||
bundle clean --force && \
|
||||
rm -rf ~/.bundle /usr/local/bundle/cache
|
||||
|
||||
RUN corepack enable && \
|
||||
corepack prepare --activate
|
||||
|
||||
RUN yarn workspaces focus --production @mastodon/mastodon;
|
||||
RUN yarn install
|
||||
|
||||
# Use Ruby on Rails to create Mastodon assets
|
||||
RUN ldconfig && \
|
||||
SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile && \
|
||||
# Cleanup temporary files
|
||||
rm -rf /app/code/tmp;
|
||||
|
||||
# Precompile bootsnap code for faster Rails startup
|
||||
RUN bundle exec bootsnap precompile --gemfile app/ lib/
|
||||
|
||||
# https://github.com/rubygems/bundler/issues/5245 means that bundle exec writes to Gemfile.lock
|
||||
RUN ln -fs /run/mastodon/bullet.log /app/code/log/bullet.log && \
|
||||
rm -rf /app/code/tmp && ln -fs /tmp/mastodon /app/code/tmp && \
|
||||
|
|
15
test/package-lock.json
generated
15
test/package-lock.json
generated
|
@ -9,7 +9,7 @@
|
|||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"chromedriver": "^129.0.1"
|
||||
"chromedriver": "^129.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
|
@ -263,10 +263,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/chromedriver": {
|
||||
"version": "129.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.1.tgz",
|
||||
"integrity": "sha512-thJqK3c7p9rIhmjBvs/cgaK0Hk30g7LbnmMXQ2aLnn75ZOiEl/2GBcgc6fw+4GIw1SmOYhnNmaEI1iTP3qob0w==",
|
||||
"version": "129.0.4",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.4.tgz",
|
||||
"integrity": "sha512-j5I55cQwodFJUaYa1tWUmj2ss9KcPRBWmUa5Qonq3X8kqv2ASPyTboFYb4YB/YLztkYTUUw2E43txXw0wYzT/A==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@testim/chrome-version": "^1.1.4",
|
||||
"axios": "^1.7.4",
|
||||
|
@ -1791,9 +1792,9 @@
|
|||
}
|
||||
},
|
||||
"chromedriver": {
|
||||
"version": "129.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.1.tgz",
|
||||
"integrity": "sha512-thJqK3c7p9rIhmjBvs/cgaK0Hk30g7LbnmMXQ2aLnn75ZOiEl/2GBcgc6fw+4GIw1SmOYhnNmaEI1iTP3qob0w==",
|
||||
"version": "129.0.4",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.4.tgz",
|
||||
"integrity": "sha512-j5I55cQwodFJUaYa1tWUmj2ss9KcPRBWmUa5Qonq3X8kqv2ASPyTboFYb4YB/YLztkYTUUw2E43txXw0wYzT/A==",
|
||||
"requires": {
|
||||
"@testim/chrome-version": "^1.1.4",
|
||||
"axios": "^1.7.4",
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
"selenium-webdriver": "^4.25.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"chromedriver": "^129.0.1"
|
||||
"chromedriver": "^129.0.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,8 +163,8 @@ describe('Application life cycle test', function () {
|
|||
await login('test@cloudron.io', testPassword);
|
||||
});
|
||||
|
||||
it('shows confirmation page', function () {
|
||||
return browser.wait(until.elementLocated(By.xpath('//div[contains(text(), "Waiting for e-mail confirmation to be completed")]')), TEST_TIMEOUT);
|
||||
it('shows confirmation page', async function () {
|
||||
await waitForElement(By.xpath('//a[@href="/auth/confirmation/new"]'));
|
||||
});
|
||||
|
||||
it('uninstall app (no sso)', async function () {
|
||||
|
|
Loading…
Reference in a new issue