mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-30 15:58:05 +09:00
clean unnecessary artifacts
This commit is contained in:
parent
059478d02e
commit
ca3a956ba5
41
Dockerfile
41
Dockerfile
@ -1,9 +1,9 @@
|
|||||||
## Install dev and compilation dependencies, build files
|
## Install dev and compilation dependencies, build files
|
||||||
FROM node:20-alpine as build
|
FROM alpine:3.18 as build
|
||||||
WORKDIR /calckey
|
WORKDIR /calckey
|
||||||
|
|
||||||
# Install compilation dependencies
|
# Install compilation dependencies
|
||||||
RUN apk add --no-cache --no-progress git alpine-sdk python3 rust cargo vips
|
RUN apk add --no-cache --no-progress git alpine-sdk python3 nodejs-current npm rust cargo vips
|
||||||
|
|
||||||
# Copy only the cargo dependency-related files first, to cache efficiently
|
# Copy only the cargo dependency-related files first, to cache efficiently
|
||||||
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml
|
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml
|
||||||
@ -25,40 +25,22 @@ COPY packages/backend/native-utils/package.json packages/backend/native-utils/pa
|
|||||||
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
|
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
|
||||||
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
|
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
|
||||||
|
|
||||||
# Configure corepack and pnpm
|
# Configure corepack and pnpm, and install dev mode dependencies for compilation
|
||||||
RUN corepack enable
|
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
|
||||||
RUN corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Install dev mode dependencies for compilation
|
# Copy in the rest of the files to compile
|
||||||
RUN pnpm i --frozen-lockfile
|
|
||||||
|
|
||||||
# Copy in the rest of the native-utils rust files
|
|
||||||
COPY packages/backend/native-utils/.cargo packages/backend/native-utils/.cargo
|
|
||||||
COPY packages/backend/native-utils/src packages/backend/native-utils/src
|
|
||||||
COPY packages/backend/native-utils/migration packages/backend/native-utils/migration
|
|
||||||
COPY packages/backend/native-utils/tests packages/backend/native-utils/tests
|
|
||||||
COPY packages/backend/native-utils/*.rs packages/backend/native-utils/
|
|
||||||
|
|
||||||
# native-utils cargo build
|
|
||||||
RUN pnpm run build:cargo
|
|
||||||
|
|
||||||
# Copy in the rest of the files, to compile from TS to JS
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN pnpm run build:recursive
|
RUN pnpm run build
|
||||||
RUN pnpm run gulp
|
|
||||||
|
|
||||||
# Trim down the dependencies to only the prod deps
|
# Trim down the artifacts and dependencies to only the prod deps
|
||||||
RUN pnpm i --prod --frozen-lockfile
|
RUN cargo clean --manifest-path /calckey/packages/backend/native-utils/Cargo.toml && pnpm i --prod --frozen-lockfile
|
||||||
|
|
||||||
# Clean up the cargo deps
|
|
||||||
RUN rm -rf /calckey/packages/backend/native-utils/target/release/deps
|
|
||||||
|
|
||||||
## Runtime container
|
## Runtime container
|
||||||
FROM node:20-alpine
|
FROM alpine:3.18
|
||||||
WORKDIR /calckey
|
WORKDIR /calckey
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apk add --no-cache --no-progress tini ffmpeg vips-dev zip unzip rust cargo
|
RUN apk add --no-cache --no-progress tini ffmpeg vips-dev zip unzip nodejs-current
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
@ -74,8 +56,7 @@ COPY --from=build /calckey/built /calckey/built
|
|||||||
COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built
|
COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built
|
||||||
COPY --from=build /calckey/packages/backend/assets/instance.css /calckey/packages/backend/assets/instance.css
|
COPY --from=build /calckey/packages/backend/assets/instance.css /calckey/packages/backend/assets/instance.css
|
||||||
COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built
|
COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built
|
||||||
COPY --from=build /calckey/packages/backend/native-utils/target/release /calckey/packages/backend/native-utils/target/release
|
|
||||||
|
|
||||||
RUN corepack enable
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||||
CMD [ "pnpm", "run", "migrateandstart" ]
|
CMD [ "pnpm", "run", "migrateandstart" ]
|
||||||
|
@ -34,10 +34,12 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"artifacts": "napi artifacts",
|
"artifacts": "napi artifacts",
|
||||||
"build": "napi build --features napi --platform --release ./built/ && cargo build --locked --release --manifest-path ./migration/Cargo.toml",
|
"build": "pnpm run build:napi && pnpm run build:migration",
|
||||||
|
"build:napi": "napi build --features napi --platform --release ./built/",
|
||||||
|
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp -v ./target/release/migration ./built/migration",
|
||||||
"build:debug": "napi build --platform ./built/ && cargo build --manifest-path ./migration/Cargo.toml",
|
"build:debug": "napi build --platform ./built/ && cargo build --manifest-path ./migration/Cargo.toml",
|
||||||
"prepublishOnly": "napi prepublish -t npm",
|
"prepublishOnly": "napi prepublish -t npm",
|
||||||
"test": "pnpm run cargo:test && pnpm run build && ava",
|
"test": "pnpm run cargo:test && pnpm run build:napi && ava",
|
||||||
"universal": "napi universal",
|
"universal": "napi universal",
|
||||||
"version": "napi version",
|
"version": "napi version",
|
||||||
"format": "cargo fmt --all",
|
"format": "cargo fmt --all",
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
"start:test": "NODE_ENV=test pnpm node ./built/index.js",
|
"start:test": "NODE_ENV=test pnpm node ./built/index.js",
|
||||||
"migrate": "pnpm run migrate:typeorm && pnpm run migrate:cargo",
|
"migrate": "pnpm run migrate:typeorm && pnpm run migrate:cargo",
|
||||||
"migrate:typeorm": "typeorm migration:run -d ormconfig.js",
|
"migrate:typeorm": "typeorm migration:run -d ormconfig.js",
|
||||||
"migrate:cargo": "./native-utils/target/release/migration up",
|
"migrate:cargo": "./native-utils/built/migration up",
|
||||||
"revertmigration": "pnpm run revertmigration:cargo && pnpm run revertmigration:typeorm",
|
"revertmigration": "pnpm run revertmigration:cargo && pnpm run revertmigration:typeorm",
|
||||||
"revertmigration:typeorm": "typeorm migration:revert -d ormconfig.js",
|
"revertmigration:typeorm": "typeorm migration:revert -d ormconfig.js",
|
||||||
"revertmigration:cargo": "./native-utils/target/release/migration down",
|
"revertmigration:cargo": "./native-utils/built/migration down",
|
||||||
"check:connect": "node ./check_connect.js",
|
"check:connect": "node ./check_connect.js",
|
||||||
"build": "pnpm swc src -d built -D",
|
"build": "pnpm swc src -d built -D",
|
||||||
"watch": "pnpm swc src -d built -D -w",
|
"watch": "pnpm swc src -d built -D -w",
|
||||||
@ -20,9 +20,6 @@
|
|||||||
"test": "pnpm run mocha",
|
"test": "pnpm run mocha",
|
||||||
"format": "pnpm rome format * --write"
|
"format": "pnpm rome format * --write"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"chokidar": "^3.3.1"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@swc/core-android-arm64": "1.3.11",
|
"@swc/core-android-arm64": "1.3.11",
|
||||||
"@tensorflow/tfjs-node": "3.21.1"
|
"@tensorflow/tfjs-node": "3.21.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user