Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
# First stage: Build stage
FROM python:3.9-slim AS build
FROM node:18-slim AS build

WORKDIR /app

RUN useradd -m appuser
# Install dependencies
COPY package*.json ./
RUN npm install

# Copy source code
COPY . .

# Second stage: Final stage
FROM python:3.9-slim
# Run linting and tests
RUN npm run lint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we technically don't need this.

RUN npm run test

RUN useradd -m appuser
# Second stage: Production stage
FROM node:18-slim

WORKDIR /app

# Create non-root user
RUN useradd -m appuser

# Copy package files and install production dependencies
COPY package*.json ./
RUN npm install --production

# Copy application files
COPY --from=build /app /app

# Set proper permissions
RUN chown -R appuser:appuser /app

USER appuser

EXPOSE 3000

CMD ["python", "-m", "http.server", "3000", "--bind", "0.0.0.0"]
# Use the serve script which uses http-server
CMD ["npm", "run", "serve"]