🎉 初始化项目
This commit is contained in:
49
web-app/Dockerfile
Normal file
49
web-app/Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
||||
FROM node:lts-alpine3.22
|
||||
|
||||
# Arguments
|
||||
ARG APP_HOME=/home/node/app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apk add --no-cache gcompat tini git git-lfs
|
||||
|
||||
# Create app directory
|
||||
WORKDIR ${APP_HOME}
|
||||
|
||||
# Set NODE_ENV to production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Bundle app source
|
||||
COPY . ./
|
||||
|
||||
RUN \
|
||||
echo "*** Install npm packages ***" && \
|
||||
npm ci --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
|
||||
|
||||
# Create config directory and link config.yaml
|
||||
RUN \
|
||||
rm -f "config.yaml" || true && \
|
||||
ln -s "./config/config.yaml" "config.yaml" || true && \
|
||||
mkdir "config" || true
|
||||
|
||||
# Pre-compile public libraries
|
||||
RUN \
|
||||
echo "*** Run Webpack ***" && \
|
||||
node "./docker/build-lib.js"
|
||||
|
||||
# Set the entrypoint script
|
||||
RUN \
|
||||
echo "*** Cleanup ***" && \
|
||||
mv "./docker/docker-entrypoint.sh" "./" && \
|
||||
rm -rf "./docker" && \
|
||||
echo "*** Make docker-entrypoint.sh executable ***" && \
|
||||
chmod +x "./docker-entrypoint.sh" && \
|
||||
echo "*** Convert line endings to Unix format ***" && \
|
||||
dos2unix "./docker-entrypoint.sh"
|
||||
|
||||
# Fix extension repos permissions
|
||||
RUN git config --global --add safe.directory "*"
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Ensure proper handling of kernel signals
|
||||
ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user