mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-27 14:28:59 +09:00
DockleのCI追加 (#9568)
* Dockerイメージ検査のCI追加 * Add cp * step分離 * step分離 * rm depends_on * Dockle実行時に必要なイメージタグ付与処理をCI内で行う * 末尾に移動 * Add comment * .git削除処理をビルドステージに移動 * docker-compose.yml作成処理追加 * aptのキャッシュ削除処理追加 * ヘルスチェック用スクリプト追加 * yqインストール処理修正 * Add ca-certificates * yqインストール処理をビルドステージに移動 * インデントを揃える * インデントをタブに変更
This commit is contained in:
parent
7df019db0e
commit
f599337320
@ -16,9 +16,15 @@ files/
|
|||||||
misskey-assets/
|
misskey-assets/
|
||||||
fluent-emojis/
|
fluent-emojis/
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# .yarn関連
|
||||||
.yarn/*
|
.yarn/*
|
||||||
!.yarn/patches
|
!.yarn/patches
|
||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/sdks
|
!.yarn/sdks
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
packages/*/.vscode/
|
||||||
|
packages/backend/test/docker-compose.yml
|
||||||
|
2
.dockleignore
Normal file
2
.dockleignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DKL-DI-0006
|
||||||
|
DKL-LI-0003
|
30
.github/workflows/dockle.yml
vendored
Normal file
30
.github/workflows/dockle.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
name: Dockle
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dockle:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_CONTENT_TRUST: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3.2.0
|
||||||
|
- run: |
|
||||||
|
curl -L -o dockle.deb "https://github.com/goodwithtech/dockle/releases/download/v0.4.10/dockle_0.4.10_Linux-64bit.deb"
|
||||||
|
sudo dpkg -i dockle.deb
|
||||||
|
- run: |
|
||||||
|
cp .config/docker_example.env .config/docker.env
|
||||||
|
cp ./docker-compose.yml.example ./docker-compose.yml
|
||||||
|
- run: |
|
||||||
|
docker compose up -d web
|
||||||
|
docker tag "$(docker compose images web | awk 'OFS=":" {print $4}' | tail -n +2)" misskey-web:latest
|
||||||
|
- run: |
|
||||||
|
cmd="dockle --exit-code 1 misskey-web:latest ${image_name}"
|
||||||
|
echo "> ${cmd}"
|
||||||
|
eval "${cmd}"
|
12
Dockerfile
12
Dockerfile
@ -8,7 +8,9 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
|
; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -yqq --no-install-recommends \
|
&& apt-get install -yqq --no-install-recommends \
|
||||||
build-essential
|
build-essential wget ca-certificates \
|
||||||
|
&& wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq \
|
||||||
|
&& chmod +x /usr/bin/yq
|
||||||
|
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ ARG NODE_ENV=production
|
|||||||
|
|
||||||
RUN git submodule update --init
|
RUN git submodule update --init
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
RUN rm -rf .git/
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-slim AS runner
|
FROM node:${NODE_VERSION}-slim AS runner
|
||||||
|
|
||||||
@ -42,13 +45,17 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ffmpeg tini \
|
ffmpeg tini \
|
||||||
|
&& rm -rf /var/lib/apt/lists \
|
||||||
&& corepack enable \
|
&& corepack enable \
|
||||||
&& groupadd -g "${GID}" misskey \
|
&& groupadd -g "${GID}" misskey \
|
||||||
&& useradd -l -u "${UID}" -g "${GID}" -m -d /misskey misskey
|
&& useradd -l -u "${UID}" -g "${GID}" -m -d /misskey misskey \
|
||||||
|
&& find / -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; \
|
||||||
|
&& find / -type f -perm /g+s -ignore_readdir_race -exec chmod g-s {} \;
|
||||||
|
|
||||||
USER misskey
|
USER misskey
|
||||||
WORKDIR /misskey
|
WORKDIR /misskey
|
||||||
|
|
||||||
|
COPY --from=builder /usr/bin/yq /usr/bin/yq
|
||||||
COPY --chown=misskey:misskey --from=builder /misskey/node_modules ./node_modules
|
COPY --chown=misskey:misskey --from=builder /misskey/node_modules ./node_modules
|
||||||
COPY --chown=misskey:misskey --from=builder /misskey/built ./built
|
COPY --chown=misskey:misskey --from=builder /misskey/built ./built
|
||||||
COPY --chown=misskey:misskey --from=builder /misskey/packages/backend/node_modules ./packages/backend/node_modules
|
COPY --chown=misskey:misskey --from=builder /misskey/packages/backend/node_modules ./packages/backend/node_modules
|
||||||
@ -58,5 +65,6 @@ COPY --chown=misskey:misskey --from=builder /misskey/fluent-emojis /misskey/flue
|
|||||||
COPY --chown=misskey:misskey . ./
|
COPY --chown=misskey:misskey . ./
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
HEALTHCHECK --interval=5s --retries=20 CMD ["/bin/bash", "/misskey/healthcheck.sh"]
|
||||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
CMD ["pnpm", "run", "migrateandstart"]
|
CMD ["pnpm", "run", "migrateandstart"]
|
||||||
|
4
healthcheck.sh
Normal file
4
healthcheck.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PORT=$(yq '.port' /misskey/.config/default.yml)
|
||||||
|
curl -s -S -o /dev/null "http://localhost:${PORT}"
|
Loading…
Reference in New Issue
Block a user