Skip to content

Commit 72631d9

Browse files
author
KHOUBZA Younes
committed
feat: add docker support
1 parent 8bc62f5 commit 72631d9

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
node_modules/
3+
docker-compose.yml
4+
Dockerfile
5+
.gitignore
6+
.editorconfig
7+
README.md
8+
Taskfile.dist.yml

Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Stage 1: Build node environment
2+
FROM node:20.2.0-alpine AS builder
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Install pnpm
8+
RUN npm install --global pnpm
9+
10+
# Copy the package.json and lock file
11+
COPY package.json pnpm-lock.yaml ./
12+
13+
# Install dependencies
14+
RUN pnpm install
15+
16+
# Copy rest of the application source code
17+
COPY . .
18+
19+
# Build the application
20+
RUN pnpm run build
21+
22+
# Stage 2: Build Ruby environment
23+
FROM ruby:2.7
24+
25+
# Set the working directory
26+
WORKDIR /app
27+
28+
# Copy Gemfile and Gemfile.lock
29+
COPY Gemfile Gemfile.lock ./
30+
31+
# Install bundle dependencies
32+
RUN bundle install
33+
34+
# Copy rest of the application source code
35+
COPY . .
36+
37+
# Copy built node app from the builder stage
38+
COPY --from=builder /app .
39+
40+
# Build Jekyll site
41+
RUN bundle exec jekyll build
42+
43+
# Expose port 4000 for the app
44+
EXPOSE 4000
45+
46+
# Expose LiveReload port
47+
EXPOSE 35729
48+
49+
# Run the app when the container launches
50+
CMD ["bundle", "exec", "jekyll", "serve", "--livereload", "--host=0.0.0.0"]

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
3+
services:
4+
web:
5+
build: .
6+
volumes:
7+
- .:/app
8+
ports:
9+
- "4000:4000"
10+
- "35729:35729"
11+
12+
watch:
13+
build: .
14+
command: [ "pnpm", "run", "watch" ]
15+
volumes:
16+
- .:/app
17+
ports:
18+
- "35729:35729"

0 commit comments

Comments
 (0)