Anthony Stirling 4aac124e76
npm login (#4296)
# Description of Changes

<!--
Please provide a summary of the changes, including:

- What was changed
- Why the change was made
- Any challenges encountered

Closes #(issue_number)
-->

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.

---------

Co-authored-by: a <a>
2025-08-26 13:46:15 +01:00

56 lines
1.5 KiB
Docker

# Frontend Dockerfile - React/Vite application
FROM node:20-alpine AS build
WORKDIR /app
# Copy package files
COPY frontend/package*.json ./
# Install dependencies (uses .npmrc secret if available, otherwise anonymous)
RUN --mount=type=secret,id=npmrc \
set -e && \
if [ -s /run/secrets/npmrc ]; then \
echo "Using authenticated npm registry" && \
echo "$(cat /run/secrets/npmrc)" > /root/.npmrc; \
else \
echo "Using anonymous npm registry (no token provided)"; \
fi && \
npm ci --loglevel=warn && \
rm -f /root/.npmrc
# Copy source code
COPY frontend .
# Build the application (uses .npmrc secret if available, otherwise anonymous)
RUN --mount=type=secret,id=npmrc \
set -e && \
if [ -s /run/secrets/npmrc ]; then \
echo "Using authenticated npm registry for build" && \
echo "$(cat /run/secrets/npmrc)" > /root/.npmrc; \
else \
echo "Using anonymous npm registry for build (no token provided)"; \
fi && \
npm run build && \
rm -f /root/.npmrc
# Production stage
FROM nginx:alpine
# Copy built files from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx configuration and entrypoint
COPY docker/frontend/nginx.conf /etc/nginx/nginx.conf
COPY docker/frontend/entrypoint.sh /entrypoint.sh
# Make entrypoint executable
RUN chmod +x /entrypoint.sh
# Expose port 80 (standard HTTP port)
EXPOSE 80
# Environment variables for flexibility
ENV VITE_API_BASE_URL=http://backend:8080
# Use custom entrypoint
ENTRYPOINT ["/entrypoint.sh"]