Skip to content

Commit

Permalink
feat: add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
KHOUBZA Younes committed May 29, 2023
1 parent 8bc62f5 commit 72631d9
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
node_modules/
docker-compose.yml
Dockerfile
.gitignore
.editorconfig
README.md
Taskfile.dist.yml
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Stage 1: Build node environment
FROM node:20.2.0-alpine AS builder

# Set the working directory
WORKDIR /app

# Install pnpm
RUN npm install --global pnpm

# Copy the package.json and lock file
COPY package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install

# Copy rest of the application source code
COPY . .

# Build the application
RUN pnpm run build

# Stage 2: Build Ruby environment
FROM ruby:2.7

# Set the working directory
WORKDIR /app

# Copy Gemfile and Gemfile.lock
COPY Gemfile Gemfile.lock ./

# Install bundle dependencies
RUN bundle install

# Copy rest of the application source code
COPY . .

# Copy built node app from the builder stage
COPY --from=builder /app .

# Build Jekyll site
RUN bundle exec jekyll build

# Expose port 4000 for the app
EXPOSE 4000

# Expose LiveReload port
EXPOSE 35729

# Run the app when the container launches
CMD ["bundle", "exec", "jekyll", "serve", "--livereload", "--host=0.0.0.0"]
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
web:
build: .
volumes:
- .:/app
ports:
- "4000:4000"
- "35729:35729"

watch:
build: .
command: [ "pnpm", "run", "watch" ]
volumes:
- .:/app
ports:
- "35729:35729"

0 comments on commit 72631d9

Please sign in to comment.