From f6dc533eaec0409ee853bd5931b5f0a7358a5b16 Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 23 Sep 2023 04:41:41 +0200 Subject: [PATCH 1/4] ci: configure stable docker build --- .github/workflows/docker.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 32a98a416d..3c6b5595d0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,10 +5,17 @@ on: types: [published] workflow_dispatch: +env: + REGISTRY: ghcr.io + jobs: push_to_registry: - name: Push Docker image to Docker Hub + name: Push Docker image to GHCR runs-on: ubuntu-latest + if: github.repository == 'transfem-org/Sharkey' + permissions: + contents: read + packages: write steps: - name: Check out the repo @@ -17,12 +24,12 @@ jobs: id: buildx uses: docker/setup-buildx-action@v3.0.0 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: - images: misskey/misskey + images: ${{ env.REGISTRY }}/transfem-org/sharkey tags: | type=edge type=ref,event=pr @@ -30,12 +37,13 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - - name: Log in to Docker Hub + - name: Log in to GHCR uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and Push to Docker Hub + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and Push to GHCR uses: docker/build-push-action@v5 with: builder: ${{ steps.buildx.outputs.name }} @@ -43,7 +51,7 @@ jobs: push: true platforms: ${{ steps.buildx.outputs.platforms }} provenance: false - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ env.REGISTRY }}/transfem-org/sharkey:stable + labels: stable cache-from: type=gha cache-to: type=gha,mode=max From 773ae9fb70e8fcc304b8251adec7deaaf945338f Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 23 Sep 2023 04:44:15 +0200 Subject: [PATCH 2/4] chore: change misskey to sharkey in dockerfile --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index d397fe01cd..84076b4c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN corepack enable -WORKDIR /misskey +WORKDIR /sharkey COPY --link ["pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "./"] COPY --link ["scripts", "./scripts"] @@ -46,7 +46,7 @@ RUN apt-get update \ RUN corepack enable -WORKDIR /misskey +WORKDIR /sharkey COPY --link ["pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "./"] COPY --link ["scripts", "./scripts"] @@ -65,8 +65,8 @@ RUN apt-get update \ ffmpeg tini curl libjemalloc-dev libjemalloc2 \ && ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so \ && corepack enable \ - && groupadd -g "${GID}" misskey \ - && useradd -l -u "${UID}" -g "${GID}" -m -d /misskey misskey \ + && groupadd -g "${GID}" sharkey \ + && useradd -l -u "${UID}" -g "${GID}" -m -d /sharkey sharkey \ && find / -type d -path /proc -prune -o -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; \ && find / -type d -path /proc -prune -o -type f -perm /g+s -ignore_readdir_race -exec chmod g-s {} \; \ && apt-get clean \ @@ -75,15 +75,15 @@ RUN apt-get update \ USER misskey WORKDIR /misskey -COPY --chown=misskey:misskey --from=target-builder /misskey/node_modules ./node_modules -COPY --chown=misskey:misskey --from=target-builder /misskey/packages/backend/node_modules ./packages/backend/node_modules -COPY --chown=misskey:misskey --from=native-builder /misskey/built ./built -COPY --chown=misskey:misskey --from=native-builder /misskey/packages/backend/built ./packages/backend/built -COPY --chown=misskey:misskey --from=native-builder /misskey/fluent-emojis /misskey/fluent-emojis -COPY --chown=misskey:misskey . ./ +COPY --chown=sharkey:sharkey --from=target-builder /sharkey/node_modules ./node_modules +COPY --chown=sharkey:sharkey --from=target-builder /sharkey/packages/backend/node_modules ./packages/backend/node_modules +COPY --chown=sharkey:sharkey --from=native-builder /sharkey/built ./built +COPY --chown=sharkey:sharkey --from=native-builder /sharkey/packages/backend/built ./packages/backend/built +COPY --chown=sharkey:sharkey --from=native-builder /sharkey/fluent-emojis /sharkey/fluent-emojis +COPY --chown=sharkey:sharkey . ./ ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so ENV NODE_ENV=production -HEALTHCHECK --interval=5s --retries=20 CMD ["/bin/bash", "/misskey/healthcheck.sh"] +HEALTHCHECK --interval=5s --retries=20 CMD ["/bin/bash", "/sharkey/healthcheck.sh"] ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["pnpm", "run", "migrateandstart"] From ea3cb92f77fe8b103cf1fe47e45502ba9a06145f Mon Sep 17 00:00:00 2001 From: Amelia Yukii <123300075+Insert5StarName@users.noreply.github.com> Date: Sat, 23 Sep 2023 04:45:07 +0200 Subject: [PATCH 3/4] fix: healtcheck.sh --- healthcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/healthcheck.sh b/healthcheck.sh index 0a36394836..16119fc49a 100644 --- a/healthcheck.sh +++ b/healthcheck.sh @@ -3,5 +3,5 @@ # SPDX-FileCopyrightText: syuilo and other misskey contributors # SPDX-License-Identifier: AGPL-3.0-only -PORT=$(grep '^port:' /misskey/.config/default.yml | awk 'NR==1{print $2; exit}') +PORT=$(grep '^port:' /sharkey/.config/default.yml | awk 'NR==1{print $2; exit}') curl -s -S -o /dev/null "http://localhost:${PORT}" From 29a0045962b381b2c224f281dbc1b96085a848cf Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 23 Sep 2023 04:45:18 +0200 Subject: [PATCH 4/4] chore: update user, workdir in dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84076b4c9a..a417355cfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,8 +72,8 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists -USER misskey -WORKDIR /misskey +USER sharkey +WORKDIR /sharkey COPY --chown=sharkey:sharkey --from=target-builder /sharkey/node_modules ./node_modules COPY --chown=sharkey:sharkey --from=target-builder /sharkey/packages/backend/node_modules ./packages/backend/node_modules