1+ FROM caddy:2-alpine AS caddy
2+ FROM oven/bun:alpine AS bun
13FROM alpine:3.22.2
24# # Building the Application
35# docker buildx build -t text0wnz:latest .
@@ -6,8 +8,7 @@ FROM alpine:3.22.2
68# docker run \
79# --cap-add=NET_BIND_SERVICE \
810# -e NODE_ENV=development \
9- # -p 80:80 -p 443:443 \
10- # -p 1337:1337 \
11+ # -p 80:80 \
1112# text0wnz:latest
1213#
1314# # Running in Production Mode:
@@ -17,42 +18,38 @@ FROM alpine:3.22.2
1718# -e SESSION_KEY=secure-production-key \
1819# -e NODE_ENV=production \
1920# -p 80:80 -p 443:443 \
20- # -p 1337:1337 \
2121# text0wnz:latest
2222
2323LABEL org.opencontainers.image.title="text0wnz"
2424LABEL org.opencontainers.image.authors="xero <x@xero.style>"
2525LABEL org.opencontainers.image.description="Text-mode art editor for ANSI, ASCII, XBIN, NFO, & TXT files"
2626LABEL org.opencontainers.image.source="https://github.com/xero/text0wnz"
27+ LABEL org.opencontainers.image.created="2025-10-17"
2728
2829ENV DOMAIN="localhost"
2930ENV PORT=1337
3031ENV NODE_ENV="production"
3132ENV XDG_DATA_HOME="/var/lib/caddy"
3233ENV XDG_CONFIG_HOME="/etc/caddy"
3334
34- # Create unprivileged user
35- RUN addgroup -S textart && \
36- adduser -S -G textart -h /app textart
37-
38- WORKDIR /app
39- COPY . .
40-
4135# Install dependencies
4236RUN apk add --no-cache \
4337 libstdc++=14.2.0-r6 \
4438 libgcc=14.2.0-r6 \
45- curl=8.14.1-r2 \
4639 ca-certificates \
47- npm=11.3.0-r1 \
48- caddy=2.10.0-r3 \
4940 gettext=0.24.1-r0 \
5041 netcat-openbsd=1.229.1-r0
51- RUN npm i -g bun
42+
43+ # Grab a caddy & toss in a bun
44+ COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
45+ COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
46+
47+ # Put the sources in the oven & bake
48+ WORKDIR /app
49+ COPY . .
5250RUN bun i && bun bake
5351
5452# Cleanup
55- RUN apk del npm
5653RUN rm -rf \
5754 .env \
5855 .git \
@@ -74,7 +71,11 @@ RUN rm -rf \
7471 tests \
7572 /var/cache/apk/*
7673
77- # Create directory structure w/ permissions for our user
74+ # Create unprivileged user
75+ RUN addgroup -S textart && \
76+ adduser -S -G textart -h /app textart
77+
78+ # Create directory structure for our user
7879RUN mkdir -p /etc/caddy /var/log /var/lib/caddy /home/textart/.local/share && \
7980 chown -R textart:textart /app /var/log /var/lib/caddy /etc/caddy /home/textart && \
8081 chmod -R 755 /app
@@ -252,15 +253,15 @@ RUN echo '#!/bin/sh' > /bootup && \
252253 chmod +x /bootup && \
253254 chown textart:textart /bootup
254255
255- # Expose ports
256- EXPOSE 80 443 $PORT
256+ # Open ports
257+ EXPOSE 80 443
257258
258259# Add health check
259260HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
260- CMD wget -q --spider http:// localhost/healthz || exit 1
261+ CMD nc -z localhost 80 || exit 1
261262
262263# Switch to non-root user
263264USER textart
264265
265- # Start services
266+ # Start drawing!
266267CMD ["/bootup" ]
0 commit comments