-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerized application for local development, testing and deployment #293
base: main
Are you sure you want to change the base?
Conversation
Dockerfile Audit and Suggested ImprovementsThe current Dockerfile implementation has several areas that could be improved to enhance performance, security, and maintainability. Here’s a detailed list of suggested changes:
Suggested Refactored DockerfileHere’s a refactored Dockerfile with the suggested improvements: # Stage 1: Build dependencies in a temporary stage
FROM node:22-alpine AS builder
# Install required global dependencies
RUN apk add --no-cache python3 make g++ \
&& npm install -g [email protected]
# Set working directory
WORKDIR /app
# Copy essential config files
COPY pnpm-workspace.yaml package.json .npmrc pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source code
COPY tsconfig.json ./
COPY docs ./docs
COPY packages ./packages
COPY scripts ./scripts
COPY characters ./characters
COPY src ./src
# Optional: build step if using TypeScript or other build process
# RUN pnpm build
# Stage 2: Production image
FROM node:22-alpine
# Install dependencies required for the final runtime
RUN apk add --no-cache python3 make g++ \
&& npm install -g [email protected]
# Create a non-root user and switch to it
RUN adduser -D appuser
USER appuser
# Set working directory
WORKDIR /app
# Copy built files from the builder stage
COPY --from=builder /app /app
# Expose application port if running a web server
EXPOSE 3000 # Adjust port as needed
# Add health check to ensure the app is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:3000 || exit 1
# Set environment variables to configure runtime model settings
ENV NODE_ENV=production
# Add more default environment variables if needed, e.g., DISCORD_APPLICATION_ID, etc.
# Default command to run the application
CMD ["pnpm", "start"] |
RUN pnpm i | ||
|
||
# Add the documentation | ||
ADD docs /app/docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs needed in the docker?
Pull Upstream
Relates to:
Distribution.
Risks
Low. Could potentially cause confusion to those unfamiliar with Docker.
Background
What does this PR do?
This PR aims to improve Eliza ergonomics by providing a one liner for getting up and running via Docker.
What kind of change is this?
Development or infrastructure support.
Why are we doing this? Any context or related work?
Improve Eliza accessibility.
Documentation changes needed?
Updated README.
Testing
Where should a reviewer start?
Detailed testing steps
Deploy Notes
We could potentially add CI/CD. Or an official Docker image. Thoughts?
Database changes
N/A