fun, image tagging, and SOURCE_TAG
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/pr/woodpecker Pipeline failed Details

kouhai dev 2023-03-16 21:09:27 -07:00
parent 758986e170
commit a12ebb8b21
3 changed files with 23 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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