Compare commits
6 Commits
master
...
docker-bet
Author | SHA1 | Date | |
---|---|---|---|
|
33e2ccd809 | ||
|
b803279b2a | ||
|
fb388d77f6 | ||
|
ebc0303d7c | ||
|
a2f157b5c4 | ||
|
b38665fcb3 |
36
.github/workflows/docker-build.yml
vendored
Normal file
36
.github/workflows/docker-build.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Build Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Docker Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
dockerfile: [Dockerfile, Dockerfile.cross]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: misskey/misskey
|
||||||
|
- name: Build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: false
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ${{ matrix.dockerfile }}
|
5
.github/workflows/docker.yml
vendored
5
.github/workflows/docker.yml
vendored
@ -13,6 +13,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v3
|
||||||
@ -27,6 +31,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
59
Dockerfile.cross
Normal file
59
Dockerfile.cross
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
FROM --platform=$BUILDPLATFORM node:16.6.2-alpine3.13 AS native_base
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
WORKDIR /misskey
|
||||||
|
|
||||||
|
ENV BUILD_DEPS autoconf automake file g++ gcc libc-dev libtool make nasm pkgconfig python3 zlib-dev git
|
||||||
|
|
||||||
|
# yarn cache を TARGETPLATFORM のステージ類で早く使いたいので yarn install までで一旦 stage を分ける
|
||||||
|
FROM native_base AS native_cache_builder
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
RUN apk add --no-cache $BUILD_DEPS && \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
FROM native_cache_builder as native_builder
|
||||||
|
|
||||||
|
RUN git submodule update --init && \
|
||||||
|
yarn build && \
|
||||||
|
rm -rf .git
|
||||||
|
|
||||||
|
# ---
|
||||||
|
|
||||||
|
FROM node:16.6.2-alpine3.13 AS base
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
WORKDIR /misskey
|
||||||
|
|
||||||
|
ENV BUILD_DEPS autoconf automake file g++ gcc libc-dev libtool make nasm pkgconfig python3 zlib-dev git
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
# build dependencies package
|
||||||
|
|
||||||
|
FROM base as deps_builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache $BUILD_DEPS
|
||||||
|
COPY --from=native_cache_builder /usr/local/share/.cache/yarn /usr/local/share/.cache/yarn
|
||||||
|
RUN SKIP_CLIENT=YES yarn install
|
||||||
|
|
||||||
|
FROM base AS runner
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
ffmpeg \
|
||||||
|
tini
|
||||||
|
|
||||||
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
|
||||||
|
# $(yarn cache dir) on container
|
||||||
|
|
||||||
|
COPY --from=deps_builder /misskey/node_modules ./node_modules
|
||||||
|
COPY --from=deps_builder /misskey/packages/backend/node_modules ./packages/backend/node_modules
|
||||||
|
COPY --from=native_builder /misskey/packages/backend/built ./packages/backend/built
|
||||||
|
COPY --from=native_builder /misskey/built ./built
|
||||||
|
|
||||||
|
CMD ["npm", "run", "migrateandstart"]
|
||||||
|
|
@ -9,6 +9,7 @@ const execa = require('execa');
|
|||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (process.env.SKIP_CLIENT !== "YES") {
|
||||||
console.log('installing dependencies of packages/client ...');
|
console.log('installing dependencies of packages/client ...');
|
||||||
|
|
||||||
await execa('yarn', ['install'], {
|
await execa('yarn', ['install'], {
|
||||||
@ -16,4 +17,5 @@ const execa = require('execa');
|
|||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user