Update Dockerfile
Michael Kinder michael@noreply.git.foggymtndrifter.com
Tue, 22 Oct 2024 13:24:10 -0400
1 files changed,
23 insertions(+),
6 deletions(-)
jump to
M
Dockerfile
→
Dockerfile
@@ -1,9 +1,26 @@
-FROM node:lts AS build -WORKDIR /app +# Stage 1: Build the Astro app +FROM node:18-alpine AS build + +WORKDIR /usr/src/app + +# Install dependencies +COPY package*.json ./ +RUN npm install + +# Copy the rest of the app COPY . . -RUN npm i + +# Build the Astro app RUN npm run build -FROM httpd:2.4 AS runtime -COPY --from=build /app/dist /usr/local/apache2/htdocs/ -EXPOSE 80+# Stage 2: Serve the app using nginx +FROM nginx:alpine + +# Copy built files to nginx's html directory +COPY --from=build /usr/src/app/dist /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start nginx +CMD ["nginx", "-g", "daemon off;"]