forked from BigMichi1/IdleCodeRedeemer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (67 loc) · 2.33 KB
/
Dockerfile
File metadata and controls
86 lines (67 loc) · 2.33 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Builder stage
FROM debian:13.4-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
curl git ca-certificates build-essential \
&& rm -rf /var/lib/apt/lists/*
# Configure Mise environment
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV MISE_DATA_DIR="/app/.mise"
ENV MISE_CONFIG_DIR="/app/.mise/config"
ENV MISE_CACHE_DIR="/app/.mise/cache"
ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
ENV PATH="/app/.mise/shims:$PATH"
# Disable SSL cert validation for Idle Champions API (expired certificate)
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
# Copy configuration files for Mise and project
COPY .mise.toml ./
COPY package.json ./
COPY esbuild.prod.js ./
COPY .env.example .env
COPY bin/mise ./bin/mise
# Trust the .mise.toml configuration file
RUN bin/mise trust
# Install tools and dependencies via Mise
RUN bin/mise install
# Install all dependencies (including dev) for building
RUN bin/mise run install
# Copy TypeScript source files
COPY tsconfig.bot.json ./
COPY src/bot ./src/bot
COPY src/lib ./src/lib
# Build the production bundle
RUN bin/mise run prod:build
# Production stage
FROM debian:13.4-slim AS production
WORKDIR /app
# Install only runtime dependencies
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Configure Mise environment
ENV MISE_DATA_DIR="/app/.mise"
ENV MISE_CONFIG_DIR="/app/.mise/config"
ENV MISE_CACHE_DIR="/app/.mise/cache"
ENV PATH="/app/.mise/shims:$PATH"
# Disable SSL cert validation for Idle Champions API (expired certificate)
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
# Copy built artifacts and necessary files from builder
COPY --from=builder /app/.mise ./.mise
COPY --from=builder /app/bin/mise ./bin/mise
COPY --from=builder /app/dist-bundle ./dist-bundle
COPY --from=builder /app/.mise.toml ./
COPY --from=builder /app/package.json ./
COPY --from=builder /app/bun.lock ./
COPY --from=builder /app/.env .env
# Install only production dependencies
RUN bin/mise run prod:install
# Create data and logs directories
RUN mkdir -p /app/data api-logs
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# Start the bot with production bundle via mise
CMD ["./bin/mise", "run", "prod:start"]