build: add docker image build entrypoint
This commit is contained in:
parent
aba2bf6281
commit
2042cba586
@ -1,7 +1,10 @@
|
|||||||
node_modules
|
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
*.md
|
node_modules
|
||||||
dist
|
apps/node_modules
|
||||||
|
apps/.turbo
|
||||||
|
apps/dist
|
||||||
.turbo
|
.turbo
|
||||||
dist.zip
|
dist
|
||||||
|
coverage
|
||||||
|
**/.DS_Store
|
||||||
|
|||||||
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
FROM node:22-slim AS builder
|
||||||
|
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=8192"
|
||||||
|
ENV TZ="Asia/Shanghai"
|
||||||
|
ENV CI="true"
|
||||||
|
|
||||||
|
RUN npm i -g corepack && corepack enable
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
|
RUN pnpm run build:antdv-next
|
||||||
|
|
||||||
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
|
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \
|
||||||
|
&& rm -rf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
COPY --from=builder /app/apps/dist /usr/share/nginx/html
|
||||||
|
COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
14
ci/build-image.sh
Executable file
14
ci/build-image.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
IMAGE_REF="${1:-}"
|
||||||
|
DOCKER_PLATFORM="${DOCKER_PLATFORM:-linux/amd64}"
|
||||||
|
|
||||||
|
if [ -z "${IMAGE_REF}" ]; then
|
||||||
|
echo "usage: ci/build-image.sh <image-ref>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${ROOT_DIR}"
|
||||||
|
docker build --platform "${DOCKER_PLATFORM}" -t "${IMAGE_REF}" .
|
||||||
Loading…
x
Reference in New Issue
Block a user