From d52df26bf69143fdd0812e935ff0ea1473ea477c Mon Sep 17 00:00:00 2001 From: commit111 Date: Thu, 10 Oct 2024 15:28:30 -0700 Subject: [PATCH] using bookworm slim instead of alpine now --- samples/vuejs/app/Dockerfile | 14 ++++++++++---- samples/vuejs/compose.dev.yaml | 11 +++++++++++ samples/vuejs/compose.yaml | 10 +++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 samples/vuejs/compose.dev.yaml diff --git a/samples/vuejs/app/Dockerfile b/samples/vuejs/app/Dockerfile index 1bcdb448..a3e6be59 100644 --- a/samples/vuejs/app/Dockerfile +++ b/samples/vuejs/app/Dockerfile @@ -1,5 +1,11 @@ -# Use Node runtime as base image -FROM node:20-alpine +# Use slim version of Node.js v20 on Debian Bookworm as base image +FROM node:20-bookworm-slim + +# Install curl for healthchecks testing +RUN apt-get update -qq \ + && apt-get install -y curl \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* # Set working directory to /app WORKDIR /app @@ -8,7 +14,7 @@ WORKDIR /app COPY package*.json ./ # Install dependencies -RUN npm install +RUN npm ci # Copy the rest of your application's code COPY . . @@ -17,4 +23,4 @@ COPY . . EXPOSE 5173 # Command to run the app when container is finished launch -CMD ["npm", "run", "dev"] \ No newline at end of file +CMD ["npm", "run", "dev"] diff --git a/samples/vuejs/compose.dev.yaml b/samples/vuejs/compose.dev.yaml new file mode 100644 index 00000000..7b5ff936 --- /dev/null +++ b/samples/vuejs/compose.dev.yaml @@ -0,0 +1,11 @@ +services: + app: + extends: + file: compose.yaml + service: app + ports: + - "5174:5173" + volumes: + - ./app:/app + - /app/node_modules + command: npm run dev \ No newline at end of file diff --git a/samples/vuejs/compose.yaml b/samples/vuejs/compose.yaml index 0ea836ad..697a27d6 100644 --- a/samples/vuejs/compose.yaml +++ b/samples/vuejs/compose.yaml @@ -5,4 +5,12 @@ services: context: ./app dockerfile: Dockerfile ports: - - "5173:5173" + - target: 5173 + published: 5173 + mode: ingress + deploy: + resources: + reservations: + memory: 512M + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5173/"] \ No newline at end of file