th: ci and image builds
Co-authored-by: Ariadne Conill <ariadne@dereferenced.org>main
parent
eebab21aa2
commit
9a9450f205
|
@ -1,22 +1,41 @@
|
||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
# Order-independent
|
||||||
|
*.sw*
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
.bundle
|
.bundle
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
.git
|
.git
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.gitignore
|
|
||||||
.github
|
.github
|
||||||
public/system
|
.gitignore
|
||||||
|
.woodpecker.yml
|
||||||
|
/*.md
|
||||||
|
build
|
||||||
|
chart
|
||||||
|
coverage
|
||||||
|
data
|
||||||
|
elasticsearch
|
||||||
|
log
|
||||||
|
neo4j
|
||||||
|
node_modules
|
||||||
|
postgres
|
||||||
|
postgres*
|
||||||
|
postgres14
|
||||||
public/assets
|
public/assets
|
||||||
public/packs
|
public/packs
|
||||||
public/packs-test
|
public/packs-test
|
||||||
node_modules
|
public/system
|
||||||
neo4j
|
|
||||||
vendor/bundle
|
|
||||||
.DS_Store
|
|
||||||
*.swp
|
|
||||||
*~
|
|
||||||
postgres
|
|
||||||
postgres14
|
|
||||||
redis
|
redis
|
||||||
elasticsearch
|
sorbet
|
||||||
chart
|
tmp
|
||||||
|
vendor/bundle
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
variables:
|
||||||
|
environment: &docker-environment
|
||||||
|
SERVER_IMAGE: gitea.treehouse.systems/treehouse/mastodon
|
||||||
|
STREAMING_IMAGE: gitea.treehouse.systems/treehouse/mastodon-streaming
|
||||||
|
DATE_COMMAND: export COMMIT_DATE=$(date -u -Idate -d @$(git show -s --format=%ct))
|
||||||
|
docker-step: &docker-step
|
||||||
|
image: docker:rc-git
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
<<: *docker-environment
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
partial: false
|
||||||
|
depth: 10
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
output:
|
||||||
|
<<: *docker-step
|
||||||
|
commands:
|
||||||
|
- eval $DATE_COMMAND
|
||||||
|
- export TAG=$${COMMIT_DATE}.$CI_COMMIT_SHA && echo $${TAG}
|
||||||
|
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $SERVER_IMAGE:$${TAG}
|
||||||
|
- docker image build -f streaming/Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $STREAMING_IMAGE:$${TAG}
|
||||||
|
- docker tag $SERVER_IMAGE:$${TAG} $SERVER_IMAGE:latest
|
||||||
|
- docker tag $STREAMING_IMAGE:$${TAG} $STREAMING_IMAGE:latest
|
||||||
|
- echo -n > tags.txt
|
||||||
|
- echo $${TAG} | tee -a tags.txt
|
||||||
|
- echo latest | tee -a tags.txt
|
||||||
|
|
||||||
|
# maybe we can use tags someday,,,
|
||||||
|
# tag-tag:
|
||||||
|
# image: *docker-git
|
||||||
|
# volumes:
|
||||||
|
# - /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
# commands:
|
||||||
|
# - docker tag $SERVER_IMAGE:latest $SERVER_IMAGE:$CI_COMMIT_TAG
|
||||||
|
# when:
|
||||||
|
# event: tag
|
||||||
|
|
||||||
|
push:
|
||||||
|
<<: *docker-step
|
||||||
|
commands:
|
||||||
|
- echo $REGISTRY_SECRET | docker login -u $REGISTRY_USER --password-stdin gitea.treehouse.systems
|
||||||
|
- cat tags.txt | xargs -n 1 -I% echo docker image push $SERVER_IMAGE:%
|
||||||
|
- cat tags.txt | xargs -n 1 -I% docker image push $SERVER_IMAGE:%
|
||||||
|
- cat tags.txt | xargs -n 1 -I% echo docker image push $STREAMING_IMAGE:%
|
||||||
|
- cat tags.txt | xargs -n 1 -I% docker image push $STREAMING_IMAGE:%
|
||||||
|
when:
|
||||||
|
event: [push, tag]
|
||||||
|
branch: main
|
||||||
|
secrets: [REGISTRY_SECRET]
|
||||||
|
environment:
|
||||||
|
<<: *docker-environment
|
||||||
|
REGISTRY_USER: ariadne
|
|
@ -30,6 +30,8 @@ ARG MASTODON_VERSION_PRERELEASE=""
|
||||||
# Append build metadata or fork information to version.rb [--build-arg MASTODON_VERSION_METADATA="pr-123456"]
|
# Append build metadata or fork information to version.rb [--build-arg MASTODON_VERSION_METADATA="pr-123456"]
|
||||||
ARG MASTODON_VERSION_METADATA=""
|
ARG MASTODON_VERSION_METADATA=""
|
||||||
|
|
||||||
|
ARG SOURCE_TAG=""
|
||||||
|
|
||||||
# Allow Ruby on Rails to serve static files
|
# Allow Ruby on Rails to serve static files
|
||||||
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
|
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
|
||||||
ARG RAILS_SERVE_STATIC_FILES="true"
|
ARG RAILS_SERVE_STATIC_FILES="true"
|
||||||
|
@ -121,13 +123,13 @@ RUN \
|
||||||
# Create temporary build layer from base image
|
# Create temporary build layer from base image
|
||||||
FROM ruby AS build
|
FROM ruby AS build
|
||||||
|
|
||||||
|
COPY --from=node /usr/local/bin /usr/local/bin
|
||||||
|
COPY --from=node /usr/local/lib /usr/local/lib
|
||||||
|
|
||||||
# Copy Node package configuration files into working directory
|
# Copy Node package configuration files into working directory
|
||||||
COPY package.json yarn.lock .yarnrc.yml /opt/mastodon/
|
COPY package.json yarn.lock .yarnrc.yml /opt/mastodon/
|
||||||
COPY .yarn /opt/mastodon/.yarn
|
COPY .yarn /opt/mastodon/.yarn
|
||||||
|
|
||||||
COPY --from=node /usr/local/bin /usr/local/bin
|
|
||||||
COPY --from=node /usr/local/lib /usr/local/lib
|
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
# hadolint ignore=DL3008
|
# hadolint ignore=DL3008
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
export NODE_ENV=production
|
||||||
|
export RAILS_ENV=production
|
||||||
|
|
||||||
|
bundle exec rake assets:clobber
|
||||||
|
bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
export RAILS_ENV=test
|
||||||
|
bundle exec rake spec
|
Loading…
Reference in New Issue