feat: Add CD

This commit is contained in:
Lucien Cartier-Tilet 2023-03-26 16:13:21 +02:00
parent a8ecf5fc1a
commit d6c9245ed5
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 27 additions and 5 deletions

22
.drone.yml Normal file
View File

@ -0,0 +1,22 @@
---
kind: pipeline
type: docker
name: CI
steps:
- name: docker
image: plugins/docker
settings:
username: phundrak
password:
from_secret: dh_key
repo: phundrak/pleroma
tags:
- latest
platform: linux/amd64
build_args: |
buildx_argv=(
--pull
--platform amd64
--tag "phundrak/pleroma:latest"
)

View File

@ -6,17 +6,17 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends unzip apt-get install -y --no-install-recommends unzip
# docker buildx will fill this in # docker buildx will fill this in
ARG TARGETARCH ARG TARGETARCH
# Clone the release build into a temporary directory and unpack it # Clone the release build into a temporary directory and unpack it
# We use ADD here to bust the cache if the pleroma release changes # We use ADD here to bust the cache if the pleroma release changes
# We use a separate layer for extraction so we don't end up with junk # We use a separate layer for extraction so we don't end up with junk
# from ADD left over in the final image. # from ADD left over in the final image.
ADD https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=${TARGETARCH} /tmp/pleroma.zip ADD https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=amd64 /tmp/pleroma.zip
RUN mkdir -p /opt/pleroma-${TARGETARCH} && \ RUN mkdir -p /opt/pleroma-amd64 && \
unzip /tmp/pleroma.zip -d /tmp/ && \ unzip /tmp/pleroma.zip -d /tmp/ && \
mv /tmp/release/* /opt/pleroma-${TARGETARCH} mv /tmp/release/* /opt/pleroma-amd64
# Ok, really build the container now # Ok, really build the container now
FROM ubuntu:20.04 AS pleroma FROM ubuntu:20.04 AS pleroma
@ -43,7 +43,7 @@ RUN mkdir -p /etc/pleroma /var/lib/pleroma/static /var/lib/pleroma/uploads && \
ARG TARGETARCH ARG TARGETARCH
COPY --chown=pleroma:pleroma --from=unzip /opt/pleroma-${TARGETARCH}/ /opt/pleroma/ COPY --chown=pleroma:pleroma --from=unzip /opt/pleroma-amd64/ /opt/pleroma/
VOLUME [ "/etc/pleroma", "/var/lib/pleroma/uploads", "/var/lib/pleroma/static" ] VOLUME [ "/etc/pleroma", "/var/lib/pleroma/uploads", "/var/lib/pleroma/static" ]