Skip to content

Commit 3fa2026

Browse files
authored
feat: use binary in slim docker image (#13)
1 parent 95fd7a2 commit 3fa2026

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

Dockerfile

+6-12
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,8 @@ RUN cd /app/ \
7070
## ##
7171
###########################################################
7272

73-
74-
# Official Bun image
75-
FROM oven/bun:${BUN_VERSION} as automation-prod
76-
77-
# Bun uses NODE_ENV for backward compatibility with Node
78-
ENV NODE_ENV="production"
79-
80-
# Simplicity first
81-
WORKDIR /app
73+
# Must be compatible with executable from Builder
74+
FROM debian:buster-slim
8275

8376
# Open Container Initiative (OCI) labels
8477
LABEL org.opencontainers.image.title="Automation Standalone" \
@@ -91,11 +84,12 @@ LABEL org.opencontainers.image.title="Automation Standalone" \
9184
org.opencontainers.image.authors="Webber Takken <[email protected]>" \
9285
org.opencontainers.image.licenses="MIT"
9386

87+
# Simplicity first
88+
WORKDIR /app
89+
9490
# Copy the distributable files and production specific dependencies
9591
COPY --from=builder /app/dist /app/package.json ./
96-
COPY --from=builder /app/node_modules node_modules
9792

9893
# Run the app
99-
USER bun
10094
EXPOSE 3000
101-
ENTRYPOINT [ "bun", "run", "server.js" ]
95+
CMD ["./server"]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dev": "bun --hot --watch src/main.ts",
1010
"sync": "yarn up \"@digital-alchemy/*\" && bunx --env-file .env type-writer",
1111
"build": "bun --env-file .env build:docker",
12-
"build:dist": "bun build src/main.ts --target=bun --outfile=dist/server.js",
12+
"build:dist": "bun build src/main.ts --compile --minify --outfile dist/server",
1313
"build:docker": "docker build . --build-arg HASS_TOKEN=$HASS_TOKEN --build-arg HASS_BASE_URL=$HASS_BASE_URL -t automation-prod",
1414
"start": "docker run --env-file .env automation-prod",
1515
"test": "vitest",

0 commit comments

Comments
 (0)