diff --git a/.woodpecker.yml b/.woodpecker.yml index c8a15a2093..9a8d352904 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,10 +14,21 @@ clone: depth: 10 pipeline: - build: + build-base: <<: *docker-step commands: - docker version + - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build-base -t $NAME:build-base + + # the world is not yet ready for this step + # test: + # <<: *docker-step + # commands: + # - docker run --rm -e RAILS_ENV=test -e NODE_ENV=development $NAME:build-base sh -c 'bundle config set --local without development && bundle install && rake spec' + + build: + <<: *docker-step + commands: - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest - docker tag $NAME:latest $NAME:$CI_COMMIT_SHA diff --git a/Dockerfile b/Dockerfile index 6c07a60a3f..136df8ba27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG NODE_VERSION="18.15-bullseye-slim" FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.1-slim as ruby -FROM node:${NODE_VERSION} as build +FROM node:${NODE_VERSION} as build-base COPY --link --from=ruby /opt/ruby /opt/ruby @@ -45,13 +45,16 @@ RUN \ yarn install --immutable && \ yarn cache clean -ENV RAILS_ENV="production" \ - NODE_ENV="production" - # Precompile assets # TODO(kouhai): we're currently patching node_modules because of emoji-mart. # we should integrate our own fork instead. COPY --link . /opt/mastodon + +FROM build-base AS build + +ENV RAILS_ENV="production" \ + NODE_ENV="production" + ENV OTP_SECRET=precompile_placeholder \ SECRET_KEY_BASE=precompile_placeholder \ RAKE_NO_YARN_INSTALL_HACK=1