diff --git a/.woodpecker.yml b/.woodpecker.yml index 651e9d7997..34a5535bb8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,9 +3,23 @@ pipeline: image: docker:rc-git volumes: - /var/run/docker.sock:/var/run/docker.sock + environment: + NAME: gitea.treehouse.systems/treehouse/mastodon commands: - docker version - - docker image build -f Dockerfile . -t gitea.treehouse.systems/treehouse/mastodon:latest + - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest + - docker tag $NAME:latest $NAME:$CI_COMMIT_SHA + - docker tag $NAME:$(date -Idate -u) + + # maybe we can use tags someday,,, + # tag-tag: + # image: docker:rc-git + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # commands: + # - docker tag $NAME:latest $NAME:$CI_COMMIT_TAG + # when: + # event: tag push: image: docker:rc-git diff --git a/Dockerfile b/Dockerfile index 26a4b34f96..665a1bea46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1.4 # This needs to be bullseye-slim because the Ruby image is built on bullseye-slim -ARG NODE_VERSION="16.19-bullseye-slim" +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 @@ -59,6 +59,7 @@ RUN bundle exec rails assets:precompile FROM node:${NODE_VERSION} +ARG SOURCE_TAG='' ARG UID="991" ARG GID="991" @@ -102,7 +103,8 @@ COPY --link --chown=mastodon:mastodon --from=build /opt/mastodon /opt/mastodon ENV RAILS_ENV="production" \ NODE_ENV="production" \ RAILS_SERVE_STATIC_FILES="true" \ - BIND="0.0.0.0" + BIND="0.0.0.0" \ + SOURCE_TAG="${SOURCE_TAG}" # Set the run user USER mastodon diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index d25d1dd3f9..da07a398ec 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def suffix - '+glitch+th' + '+glitch.th' end def to_a @@ -42,7 +42,9 @@ module Mastodon # specify git tag or commit hash here def source_tag - ENV.fetch('SOURCE_TAG', nil) + tag = ENV.fetch('SOURCE_TAG', nil) + return if tag.nil? || tag.empty? + tag end def source_url