]> Untitled Git - lemmy.git/commitdiff
Drone release main (ref #1556) (#1557)
authorNutomic <me@nutomic.com>
Thu, 8 Apr 2021 14:33:58 +0000 (14:33 +0000)
committerGitHub <noreply@github.com>
Thu, 8 Apr 2021 14:33:58 +0000 (10:33 -0400)
* 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`

.drone.yml
docker/dev/docker-compose.yml
docker/dev/docker_update.sh
docker/dev/docker_update_volume_mount.sh
docker/federation/docker-compose.yml
docker/federation/start-local-instances.bash
docker/prod/Dockerfile
docker/prod/deploy.sh

index 7dd4d3e79e23eec5bb4d3b581788d07dabd2cb91..18db1fad7ced0407c7eddc57f32fdeabc47d593b 100644 (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
index 5661ce55ec32db77dc50cd3e50e971ab2e7406e1..7f8979fe68272e614d05b6c5077d8b7bbd502e66 100644 (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
index 4531a1bddf404483b16266fcf0f88ddb3b45ae4f..9623d4dce76961614e4c98f813fff7e93b27b6cb 100755 (executable)
@@ -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
index bc4f832fe6eee455234e893e6fe89634b550d8f3..7fbd212a5db6fca5fa1decf019aa86fdcc2b11d4 100755 (executable)
@@ -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
index 74b84e2d9f3cca0117a4df3964ad8968ae12244e..c13c89ea4f32e714ac9231400e2a56f677ad629f 100644 (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
index e963792adf60cb33f54990f7f1dfdb1c3d722730..74f629e9c4094127e06660550b0034ad6be02088 100755 (executable)
@@ -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
index 88a05fb269acc89fb7bf55933be625e833a1b88f..75c53e67527bb5b0cea8fbd4051bcafb43e42039 100644 (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 .
index b2ee16635d095bbd86af9c31054179f7610fae9a..7520f1495abd6cce7dd69b324bb4d7eb74693647 100755 (executable)
@@ -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