Update Dockefile, .prettierignore and .eslintignore to make the build image launch the simple hello world app.

This commit is contained in:
Joel Wejdenstål 2023-12-07 06:24:13 +01:00
parent 68ff272228
commit 6dcf82580a
No known key found for this signature in database
GPG key ID: 61FEB280F91833C6
3 changed files with 32 additions and 7 deletions

View file

@ -1,2 +1,7 @@
/archetypes
/assets
/content
/layouts
/static
/dist
node_modules

View file

@ -3,4 +3,5 @@
/content
/layouts
/static
/dist
node_modules

View file

@ -1,8 +1,8 @@
# Create a builder step.
FROM ubuntu:20.04 as builder
# Create a site builder step.
FROM ubuntu:20.04 as site-builder
# Set the working directory.
WORKDIR /app-builder
WORKDIR /site-builder
# Install package dependencies.
RUN apt-get update && apt-get install -y wget git build-essential
@ -16,17 +16,36 @@ ENV GOBIN="/usr/local/go/bin"
# Build and install Hugo.
RUN CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
# Copy the source code.
# Copy the site source code.
COPY . .
# Build the site.
RUN hugo --minify
# Create the final step.
# Create the app builder step.
FROM node:21.3.0-bookworm as app-builder
# Set the working directory.
WORKDIR /app-builder
# Copy the project source code.
COPY . .
# Install dependencies for building the project.
RUN npm ci
# Build the project for production.
RUN npm run build
# Create the app step.
FROM node:21.3.0-bookworm as app
# Set the working directory.
WORKDIR /app
# Copy built site from builder step.
COPY --from=builder /app-builder/public /app/public
# Copy built project to the app image.
COPY --from=app-builder /app-builder/dist /app
COPY --from=app-builder /app-builder/node_modules /app/node_modules
# Run the app.
CMD ["node", "main.js"]