Drone release main (ref #1556) (#1557)

* publish docker images from main

* try with separate step

* redo, lots of boilerplate

* try to fix syntax

* unique step names

* fix docker tags, remove cargo-chef

* only build dev image on main branch

* use `ref` for condition, as `branch` uses the target branch for PRs

* consistent indents

* fix tag

* use lemmy-ui:dev image for `docker/dev` and `docker/federation`
This commit is contained in:
Nutomic 2021-04-08 14:33:58 +00:00 committed by GitHub
parent c3d64f996e
commit b8a6592369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 81 additions and 49 deletions

View File

@ -55,7 +55,39 @@ steps:
- yarn
- yarn api-test
- name: make release build and push to docker hub
- name: publish dev docker image
image: plugins/docker
settings:
dockerfile: docker/prod/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: dessalines/lemmy
tags:
- dev-linux-amd64
when:
ref:
- refs/heads/main
- name: publish dev docker manifest
image: plugins/manifest
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
target: "dessalines/lemmy:dev"
template: "dessalines/lemmy:dev-OS-ARCH"
platforms:
- linux/amd64
- linux/arm64
ignore_missing: true
when:
ref:
- refs/heads/main
- name: publish release docker image
image: plugins/docker
settings:
dockerfile: docker/prod/Dockerfile
@ -68,9 +100,9 @@ steps:
auto_tag_suffix: linux-amd64
when:
ref:
- refs/tags/*
- refs/tags/*
- name: push to docker manifest
- name: publish release docker manifest
image: plugins/manifest
settings:
username:
@ -85,7 +117,7 @@ steps:
ignore_missing: true
when:
ref:
- refs/tags/*
- refs/tags/*
services:
- name: database
@ -140,7 +172,39 @@ steps:
- yarn
- yarn api-test
- name: make release build and push to docker hub
- name: publish dev docker image
image: plugins/docker
settings:
dockerfile: docker/prod/Dockerfile.arm
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: dessalines/lemmy
tags:
- dev-linux-arm64
when:
ref:
- refs/heads/main
- name: publish dev docker manifest
image: plugins/manifest
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
target: "dessalines/lemmy:dev"
template: "dessalines/lemmy:dev-OS-ARCH"
platforms:
- linux/amd64
- linux/arm64
ignore_missing: true
when:
ref:
- refs/heads/main
- name: publish release docker image
image: plugins/docker
settings:
dockerfile: docker/prod/Dockerfile.arm
@ -155,7 +219,7 @@ steps:
ref:
- refs/tags/*
- name: push to docker manifest
- name: publish release docker manifest
image: plugins/manifest
settings:
username:
@ -170,7 +234,7 @@ steps:
ignore_missing: true
when:
ref:
- refs/tags/*
- refs/tags/*
services:
- name: database

View File

@ -17,7 +17,7 @@ services:
- iframely
lemmy-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
ports:
- "1235:1234"
restart: always

View File

@ -8,4 +8,5 @@ set -e
mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-dev:latest
sudo docker-compose pull --ignore-pull-failures || true
sudo docker-compose up -d

View File

@ -8,4 +8,5 @@ set -e
mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
sudo docker build ../../ --file ../dev/volume_mount.dockerfile -t lemmy-dev:latest
sudo docker-compose pull --ignore-pull-failures || true
sudo docker-compose up

View File

@ -29,7 +29,7 @@ services:
- ./volumes/pictrs_alpha:/mnt
lemmy-alpha-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
environment:
- LEMMY_INTERNAL_HOST=lemmy-alpha:8541
- LEMMY_EXTERNAL_HOST=localhost:8541
@ -58,7 +58,7 @@ services:
- ./volumes/postgres_alpha:/var/lib/postgresql/data
lemmy-beta-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
environment:
- LEMMY_INTERNAL_HOST=lemmy-beta:8551
- LEMMY_EXTERNAL_HOST=localhost:8551
@ -87,7 +87,7 @@ services:
- ./volumes/postgres_beta:/var/lib/postgresql/data
lemmy-gamma-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
environment:
- LEMMY_INTERNAL_HOST=lemmy-gamma:8561
- LEMMY_EXTERNAL_HOST=localhost:8561
@ -117,7 +117,7 @@ services:
# An instance with only an allowlist for beta
lemmy-delta-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
environment:
- LEMMY_INTERNAL_HOST=lemmy-delta:8571
- LEMMY_EXTERNAL_HOST=localhost:8571
@ -147,7 +147,7 @@ services:
# An instance who has a blocklist, with lemmy-alpha blocked
lemmy-epsilon-ui:
image: dessalines/lemmy-ui:0.10.3
image: dessalines/lemmy-ui:dev
environment:
- LEMMY_INTERNAL_HOST=lemmy-epsilon:8581
- LEMMY_EXTERNAL_HOST=localhost:8581

View File

@ -8,4 +8,5 @@ for Item in alpha beta gamma delta epsilon ; do
sudo chown -R 991:991 volumes/pictrs_$Item
done
sudo docker-compose pull --ignore-pull-failures || true
sudo docker-compose up

View File

@ -1,38 +1,11 @@
ARG RUST_BUILDER_IMAGE=ekidd/rust-musl-builder:1.50.0
# Cargo chef plan
FROM $RUST_BUILDER_IMAGE as planner
WORKDIR /app
RUN cargo install cargo-chef
# Copy dirs
COPY ./ ./
RUN sudo chown -R rust:rust .
RUN cargo chef prepare --recipe-path recipe.json
# Cargo chef cache dependencies
FROM $RUST_BUILDER_IMAGE as cacher
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
WORKDIR /app
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json ./recipe.json
RUN sudo chown -R rust:rust .
RUN cargo chef cook --release --target ${CARGO_BUILD_TARGET} --recipe-path recipe.json
# Build the project
FROM $RUST_BUILDER_IMAGE as builder
FROM ekidd/rust-musl-builder:1.50.0 as builder
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
ARG RUSTRELEASEDIR="release"
WORKDIR /app
# Copy over the cached dependencies
COPY --from=cacher /app/target target
COPY --from=cacher /home/rust/.cargo /home/rust/.cargo
# Copy the rest of the dirs
COPY ./ ./
RUN sudo chown -R rust:rust .

View File

@ -12,14 +12,6 @@ echo "pub const VERSION: &str = \"$new_tag\";" > "crates/utils/src/version.rs"
git add "crates/utils/src/version.rs"
popd
# Changing various references to the Lemmy version
sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../dev/docker-compose.yml
sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../dev/docker-compose.yml
sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../federation/docker-compose.yml
sed -i "s/dessalines\/lemmy-ui:.*/dessalines\/lemmy-ui:$new_tag/" ../federation/docker-compose.yml
git add ../dev/docker-compose.yml
git add ../federation/docker-compose.yml
# The ansible and docker installs should only update for non release-candidates
# IE, when the third semver is a number, not '2-rc'
if [ ! -z "${third_semver##*[!0-9]*}" ]; then