FROM node:20-slim | |
WORKDIR /app | |
COPY . /app | |
RUN ls -al /app | |
RUN mkdir config | |
COPY w_env.ts /app/server/env.ts | |
# 将当前目录下的所有文件复制到工作目录 | |
#ENV NODE_ENV=production | |
RUN npm install | |
RUN --mount=type=secret,id=API_KEY,mode=0444,required=true \ | |
echo "GOOGLE_API_KEY=$(cat /run/secrets/API_KEY)" > /app/config/.env | |
#RUN cat /app/config/.env | |
RUN chmod -R 777 /app/node_modules/ | |
#RUN npm run build | |
# Start the server by default, this can be overwritten at runtime | |
EXPOSE 3000 | |
#ENV GOOGLE_API_KEY=$(cat /run/secrets/API_KEY) | |
CMD ["npm", "run", "dev"] | |