-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (36 loc) · 1.11 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Online Web SSH Frontend Dockerfile
FROM node:20-alpine as builder
LABEL maintainer="Seyyed Ali Mohammadiyeh (MAX BASE) <maxbasecode@gmail.com>"
LABEL description="Online Web SSH - Web-based SSH Client"
LABEL version="1.0.0"
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm ci --only=production
# Copy application files
COPY index.html ./
COPY static ./static/
# Production stage - Use lightweight HTTP server
FROM node:20-alpine
WORKDIR /app
# Install http-server globally
RUN npm install -g http-server
# Copy files from builder
COPY --from=builder /app .
# Create non-root user for security
RUN addgroup -g 1000 webssh && \
adduser -D -u 1000 -G webssh webssh && \
chown -R webssh:webssh /app
# Switch to non-root user
USER webssh
# Expose port
EXPOSE 8080
# Environment variables
ENV HOST=0.0.0.0
ENV PORT=8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:8080/ || exit 1
# Start HTTP server
CMD ["http-server", "-p", "8080", "-c-1", "-a", "0.0.0.0"]