Add drone CI for arm
This commit is contained in:
parent
ccd2b9eb75
commit
f06b71d961
2 changed files with 127 additions and 6 deletions
85
.drone.yml
85
.drone.yml
|
@ -1,5 +1,10 @@
|
||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: fetch git submodules
|
- name: fetch git submodules
|
||||||
|
@ -54,7 +59,6 @@ steps:
|
||||||
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
||||||
DO_WRITE_HOSTS_FILE: 1
|
DO_WRITE_HOSTS_FILE: 1
|
||||||
commands:
|
commands:
|
||||||
- ls -la target/lemmy_server
|
|
||||||
- apk add bash curl postgresql-client
|
- apk add bash curl postgresql-client
|
||||||
- bash api_tests/prepare-drone-federation-test.sh
|
- bash api_tests/prepare-drone-federation-test.sh
|
||||||
- cd api_tests/
|
- cd api_tests/
|
||||||
|
@ -62,7 +66,7 @@ steps:
|
||||||
- yarn api-test
|
- yarn api-test
|
||||||
|
|
||||||
- name: create docker tags
|
- name: create docker tags
|
||||||
image: ekidd/rust-musl-builder:1.47.0
|
image: node:15-alpine3.12
|
||||||
commands:
|
commands:
|
||||||
- echo "$(git describe),latest" > .tags
|
- echo "$(git describe),latest" > .tags
|
||||||
when:
|
when:
|
||||||
|
@ -90,6 +94,75 @@ services:
|
||||||
POSTGRES_USER: lemmy
|
POSTGRES_USER: lemmy
|
||||||
POSTGRES_PASSWORD: password
|
POSTGRES_PASSWORD: password
|
||||||
|
|
||||||
volumes:
|
---
|
||||||
- name: dieselcli
|
kind: pipeline
|
||||||
temp: {}
|
name: arm64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: cargo test
|
||||||
|
image: rust:1.47-slim-buster
|
||||||
|
environment:
|
||||||
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
RUST_TEST_THREADS: 1
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
|
||||||
|
- cargo test --workspace --no-fail-fast
|
||||||
|
- cargo build
|
||||||
|
|
||||||
|
# Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
|
||||||
|
- name: cargo build
|
||||||
|
image: rust:1.47-slim-buster
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
|
||||||
|
- cargo build
|
||||||
|
- mv target/debug/lemmy_server target/lemmy_server
|
||||||
|
|
||||||
|
- name: run federation tests
|
||||||
|
image: node:15-buster-slim
|
||||||
|
environment:
|
||||||
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
||||||
|
DO_WRITE_HOSTS_FILE: 1
|
||||||
|
commands:
|
||||||
|
- mkdir -p /usr/share/man/man1 /usr/share/man/man7
|
||||||
|
- apt-get update
|
||||||
|
- apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
|
||||||
|
- bash api_tests/prepare-drone-federation-test.sh
|
||||||
|
- cd api_tests/
|
||||||
|
- yarn
|
||||||
|
- yarn api-test
|
||||||
|
|
||||||
|
- name: create docker tags
|
||||||
|
image: node:15-buster-slim
|
||||||
|
commands:
|
||||||
|
- echo "$(git describe),latest" > .tags
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/*
|
||||||
|
|
||||||
|
- name: make release build and push to docker hub
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
dockerfile: docker/prod/Dockerfile.arm
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: dessalines/lemmy
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/*
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: database
|
||||||
|
image: postgres:12-alpine
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: lemmy
|
||||||
|
POSTGRES_PASSWORD: password
|
48
docker/prod/Dockerfile.arm
Normal file
48
docker/prod/Dockerfile.arm
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
ARG RUST_BUILDER_IMAGE=rust:1.47-slim-buster
|
||||||
|
|
||||||
|
# Build Lemmy
|
||||||
|
FROM $RUST_BUILDER_IMAGE as builder
|
||||||
|
|
||||||
|
# Install compilation dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ./ ./
|
||||||
|
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# reduce binary size
|
||||||
|
RUN strip ./target/release/lemmy_server
|
||||||
|
|
||||||
|
RUN cp ./target/release/lemmy_server /app/lemmy_server
|
||||||
|
|
||||||
|
# Build the docs
|
||||||
|
FROM $RUST_BUILDER_IMAGE as docs
|
||||||
|
WORKDIR /app
|
||||||
|
RUN cargo install --debug mdbook
|
||||||
|
COPY docs ./docs
|
||||||
|
RUN mdbook build docs/
|
||||||
|
|
||||||
|
# The Debian runner
|
||||||
|
FROM debian:buster-slim as lemmy
|
||||||
|
|
||||||
|
# Install libpq for postgres and espeak for captchas
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y install --no-install-recommends espeak postgresql-client libc6 libssl1.1 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN addgroup --gid 1000 lemmy
|
||||||
|
RUN adduser --no-create-home --shell /bin/sh --uid 1000 --gid 1000 lemmy
|
||||||
|
|
||||||
|
# Copy resources
|
||||||
|
COPY --chown=lemmy:lemmy config/defaults.hjson /config/defaults.hjson
|
||||||
|
COPY --chown=lemmy:lemmy --from=builder /app/lemmy_server /app/lemmy
|
||||||
|
COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/documentation/
|
||||||
|
|
||||||
|
RUN chown lemmy:lemmy /app/lemmy
|
||||||
|
USER lemmy
|
||||||
|
EXPOSE 8536
|
||||||
|
CMD ["/app/lemmy"]
|
Loading…
Reference in a new issue