summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorMasaya Suzuki <15100604+massongit@users.noreply.github.com>2023-02-05 14:04:02 +0900
committerGitHub <noreply@github.com>2023-02-05 14:04:02 +0900
commitf5993373200746856ccdcd8629d8180c8d3d1b5a (patch)
treea1e1aae07f14ca54320223f6735c18ccc99141b3 /Dockerfile
parentBuildX設定漏れ修正 (#9741) (diff)
downloadsharkey-f5993373200746856ccdcd8629d8180c8d3d1b5a.tar.gz
sharkey-f5993373200746856ccdcd8629d8180c8d3d1b5a.tar.bz2
sharkey-f5993373200746856ccdcd8629d8180c8d3d1b5a.zip
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インストール処理をビルドステージに移動 * インデントを揃える * インデントをタブに変更
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile12
1 files changed, 10 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 3876b5f6ce..9b6f2f7e30 100644
--- a/Dockerfile
+++ b/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 \
&& apt-get update \
&& 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
@@ -29,6 +31,7 @@ ARG NODE_ENV=production
RUN git submodule update --init
RUN pnpm build
+RUN rm -rf .git/
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 install -y --no-install-recommends \
ffmpeg tini \
+ && rm -rf /var/lib/apt/lists \
&& corepack enable \
&& 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
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/built ./built
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 . ./
ENV NODE_ENV=production
+HEALTHCHECK --interval=5s --retries=20 CMD ["/bin/bash", "/misskey/healthcheck.sh"]
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["pnpm", "run", "migrateandstart"]