2023-03-17 06:09:27 +02:00
|
|
|
variables:
|
2023-04-24 12:22:10 +03:00
|
|
|
environment: &docker-environment
|
2024-02-01 20:09:23 +02:00
|
|
|
SERVER_IMAGE: gitea.treehouse.systems/treehouse/mastodon
|
|
|
|
STREAMING_IMAGE: gitea.treehouse.systems/treehouse/mastodon-streaming
|
2023-04-24 12:22:10 +03:00
|
|
|
DATE_COMMAND: export COMMIT_DATE=$(date -u -Idate -d @$(git show -s --format=%ct))
|
2023-03-17 06:09:27 +02:00
|
|
|
docker-step: &docker-step
|
2022-12-29 00:27:57 +02:00
|
|
|
image: docker:rc-git
|
2022-11-12 12:55:53 +02:00
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
2023-03-17 06:09:27 +02:00
|
|
|
environment:
|
2023-04-24 12:22:10 +03:00
|
|
|
<<: *docker-environment
|
2023-04-22 10:20:04 +03:00
|
|
|
|
|
|
|
clone:
|
|
|
|
git:
|
|
|
|
image: woodpeckerci/plugin-git
|
|
|
|
settings:
|
|
|
|
partial: false
|
2023-07-07 09:08:07 +03:00
|
|
|
depth: 10
|
2023-04-22 10:20:04 +03:00
|
|
|
|
2023-03-17 06:09:27 +02:00
|
|
|
pipeline:
|
2023-07-07 08:46:49 +03:00
|
|
|
output:
|
2023-04-22 10:14:40 +03:00
|
|
|
<<: *docker-step
|
|
|
|
commands:
|
2023-04-24 10:05:57 +03:00
|
|
|
- eval $DATE_COMMAND
|
|
|
|
- export TAG=$${COMMIT_DATE}.$CI_COMMIT_SHA && echo $${TAG}
|
2024-02-01 20:09:23 +02:00
|
|
|
- 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
|
2024-02-11 06:22:44 +02:00
|
|
|
- docker tag $STREAMING_IMAGE:$${TAG} $STREAMING_IMAGE:latest
|
2024-02-01 20:09:23 +02:00
|
|
|
- echo -n > tags.txt
|
|
|
|
- echo $${TAG} | tee -a tags.txt
|
|
|
|
- echo latest | tee -a tags.txt
|
2023-03-17 06:09:27 +02:00
|
|
|
|
|
|
|
# maybe we can use tags someday,,,
|
|
|
|
# tag-tag:
|
|
|
|
# image: *docker-git
|
|
|
|
# volumes:
|
|
|
|
# - /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
# commands:
|
2024-02-01 20:09:23 +02:00
|
|
|
# - docker tag $SERVER_IMAGE:latest $SERVER_IMAGE:$CI_COMMIT_TAG
|
2023-03-17 06:09:27 +02:00
|
|
|
# when:
|
|
|
|
# event: tag
|
2022-11-12 12:50:24 +02:00
|
|
|
|
|
|
|
push:
|
2023-03-17 06:09:27 +02:00
|
|
|
<<: *docker-step
|
2022-11-12 12:50:24 +02:00
|
|
|
commands:
|
2023-04-24 10:05:57 +03:00
|
|
|
- echo $REGISTRY_SECRET | docker login -u $REGISTRY_USER --password-stdin gitea.treehouse.systems
|
2024-02-01 20:09:23 +02:00
|
|
|
- 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:%
|
2022-11-12 12:50:24 +02:00
|
|
|
when:
|
|
|
|
event: [push, tag]
|
2022-11-13 05:23:58 +02:00
|
|
|
branch: main
|
2022-11-12 16:08:48 +02:00
|
|
|
secrets: [REGISTRY_SECRET]
|
2023-04-24 10:05:57 +03:00
|
|
|
environment:
|
2023-04-24 12:22:10 +03:00
|
|
|
<<: *docker-environment
|
2023-04-24 10:05:57 +03:00
|
|
|
REGISTRY_USER: ariadne
|