diff --git a/docker/haste/Dockerfile b/docker/haste/Dockerfile index ebd9c4f..7619447 100644 --- a/docker/haste/Dockerfile +++ b/docker/haste/Dockerfile @@ -1,23 +1,20 @@ FROM node:18-alpine as builder +# Install git and other dependencies +RUN apk add --no-cache git + +# Clone the repository +RUN git clone --depth 1 https://git.nixc.us/Nixius/hastebin.git /app + WORKDIR /app -# Copy package files first - this is the key fix -COPY package.json package-lock.json ./ - -# Clean npm cache and install dependencies with specific flags to avoid errors +# Clean npm cache and install dependencies with better error handling RUN npm cache clean --force && \ npm install --production --no-optional && \ - npm install mocha + chmod +x app.sh -# Copy the rest of the application AFTER installing dependencies -COPY . . - -# Make sure app.sh is executable -RUN chmod +x app.sh - -# Build assets -RUN node update-js.js +# Build assets if needed +RUN node update-js.js || echo "No update-js.js script found" FROM node:18-alpine @@ -26,10 +23,14 @@ WORKDIR /app # Copy from builder stage COPY --from=builder /app . +# Install mocha in the final image +RUN npm install mocha + # Set environment variables ENV NODE_ENV=production \ HASTEBIN_ENABLE_CSP=true \ - HASTEBIN_ENABLE_HSTS=true + HASTEBIN_ENABLE_HSTS=true \ + HASTEBIN_ENABLE_CROSS_ORIGIN_ISOLATION=true # Expose port EXPOSE 7777