-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (38 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
49 lines (38 loc) · 1.1 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
# Stage 0: Base
FROM oven/bun:1.3.13-alpine AS base
# Set the working directory
WORKDIR /app
# Set environment variables
ENV TZ=America/Chicago \
ASF_PROTOCOL=http \
ASF_HOST=localhost \
ASF_PORT=1242 \
ASF_COMMAND_PREFIX=! \
ASF_BOTS=asf \
ASF_CLAIM_INTERVAL=3 \
GITHUB_TOKEN= \
WEBHOOK_URL=none \
WEBHOOK_ENABLEDTYPES=error;warn;success \
WEBHOOK_SHOWACCOUNTSTATUS=true
# Stage 1: Build
FROM base AS build
# Copy package definitions
COPY package.json .
# Install project dependencies
RUN bun install
# Copy the application source code
COPY ./index.js .
# Stage 2: Final
FROM base AS final
# Install runtime system dependencies and set up the application directory
RUN apk add --no-cache tzdata && \
mkdir -p /app/storage && \
chown -R bun:bun /app
# Copy dependencies and application code from the build stage
COPY --from=build --chown=bun:bun /app/node_modules ./node_modules
COPY --from=build --chown=bun:bun /app/package.json .
COPY --from=build --chown=bun:bun /app/index.js .
# Switch to a non-root user
USER bun
# Set the default command
CMD ["bun", "index.js"]