Skip to content

Commit

Permalink
Add npm install step to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
logansparlin committed May 26, 2024
1 parent 5dc128d commit 6af4174
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 204 deletions.
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Stage 1: Build and install Node.js dependencies
FROM node:18-alpine as nodebuilder

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json (or yarn.lock if you use Yarn)
COPY app/package.json app/package-lock.json ./

# Install dependencies
RUN npm install

# Optionally, if your application needs to be built:
# COPY app/ ./
# RUN npm run build

# Stage 2: Setup the final image with Jekyll and Node.js environment
FROM tiryoh/jekyll:4.2.1

# Copy Node.js build artifacts from the previous stage
COPY --from=nodebuilder /app/node_modules /srv/jekyll/node_modules

# Copy your application code, if there's anything to run directly
# COPY --from=nodebuilder /app /srv/jekyll

# Set the working directory
WORKDIR /srv/jekyll

# Add Node.js and npm to PATH
ENV PATH="/srv/jekyll/node_modules/.bin:${PATH}"

# Continue setting up your Jekyll environment
# For example, copy over your Jekyll site files
# COPY . /srv/jekyll

# Expose the port Jekyll will run on
EXPOSE 8080

# Command to run your Jekyll site
CMD ["jekyll", "build", "--watch"]
Loading

0 comments on commit 6af4174

Please sign in to comment.