diff --git a/Dockerfile b/Dockerfile index ef978f2..94be6ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,15 +70,8 @@ RUN cd /app/ \ ## ## ########################################################### - -# Official Bun image -FROM oven/bun:${BUN_VERSION} as automation-prod - -# Bun uses NODE_ENV for backward compatibility with Node -ENV NODE_ENV="production" - -# Simplicity first -WORKDIR /app +# Must be compatible with executable from Builder +FROM debian:buster-slim # Open Container Initiative (OCI) labels LABEL org.opencontainers.image.title="Automation Standalone" \ @@ -91,11 +84,12 @@ LABEL org.opencontainers.image.title="Automation Standalone" \ org.opencontainers.image.authors="Webber Takken " \ org.opencontainers.image.licenses="MIT" +# Simplicity first +WORKDIR /app + # Copy the distributable files and production specific dependencies COPY --from=builder /app/dist /app/package.json ./ -COPY --from=builder /app/node_modules node_modules # Run the app -USER bun EXPOSE 3000 -ENTRYPOINT [ "bun", "run", "server.js" ] +CMD ["./server"] diff --git a/package.json b/package.json index 650aa7f..f20a787 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev": "bun --hot --watch src/main.ts", "sync": "yarn up \"@digital-alchemy/*\" && bunx --env-file .env type-writer", "build": "bun --env-file .env build:docker", - "build:dist": "bun build src/main.ts --target=bun --outfile=dist/server.js", + "build:dist": "bun build src/main.ts --compile --minify --outfile dist/server", "build:docker": "docker build . --build-arg HASS_TOKEN=$HASS_TOKEN --build-arg HASS_BASE_URL=$HASS_BASE_URL -t automation-prod", "start": "docker run --env-file .env automation-prod", "test": "vitest",