Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -36
Dockerfile
CHANGED
|
@@ -1,49 +1,26 @@
|
|
| 1 |
# Build stage
|
| 2 |
-
FROM node:20
|
| 3 |
|
| 4 |
-
# Install pnpm
|
| 5 |
RUN npm install -g pnpm
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
RUN apk add --no-cache git
|
| 10 |
RUN git clone https://github.com/NitroRCr/AIaW.git . && \
|
| 11 |
git checkout -f $(git describe --tags $(git rev-list --tags --max-count=1))
|
| 12 |
|
| 13 |
-
# Copy environment configuration for Docker build
|
| 14 |
-
COPY <<EOF .env.local
|
| 15 |
-
# Basic configuration for static build
|
| 16 |
-
VITE_APP_VERSION=$(git describe --tags)
|
| 17 |
-
EOF
|
| 18 |
-
|
| 19 |
-
# Install dependencies and build
|
| 20 |
RUN pnpm install
|
| 21 |
RUN pnpm build -m pwa
|
| 22 |
|
| 23 |
-
# Serve stage
|
| 24 |
-
FROM
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
listen 7860;\n\
|
| 32 |
-
server_name localhost;\n\
|
| 33 |
-
root /usr/share/nginx/html;\n\
|
| 34 |
-
index index.html;\n\
|
| 35 |
-
location / {\n\
|
| 36 |
-
try_files $uri $uri/ /index.html;\n\
|
| 37 |
-
}\n\
|
| 38 |
-
# Handle WebSocket connections if needed\n\
|
| 39 |
-
location /ws {\n\
|
| 40 |
-
proxy_http_version 1.1;\n\
|
| 41 |
-
proxy_set_header Upgrade $http_upgrade;\n\
|
| 42 |
-
proxy_set_header Connection "upgrade";\n\
|
| 43 |
-
}\n\
|
| 44 |
-
}' > /etc/nginx/conf.d/default.conf
|
| 45 |
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
CMD ["
|
|
|
|
| 1 |
# Build stage
|
| 2 |
+
FROM node:20 AS builder
|
| 3 |
|
|
|
|
| 4 |
RUN npm install -g pnpm
|
| 5 |
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 8 |
RUN git clone https://github.com/NitroRCr/AIaW.git . && \
|
| 9 |
git checkout -f $(git describe --tags $(git rev-list --tags --max-count=1))
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN pnpm install
|
| 12 |
RUN pnpm build -m pwa
|
| 13 |
|
| 14 |
+
# Serve stage - using Python for simplicity
|
| 15 |
+
FROM python:3.11-slim
|
| 16 |
+
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
USER user
|
| 19 |
+
WORKDIR /home/user
|
| 20 |
+
|
| 21 |
+
COPY --from=builder --chown=user:user /app/dist/pwa ./app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# Serve the PWA
|
| 26 |
+
CMD ["python", "-m", "http.server", "7860", "--directory", "app"]
|