Skip to content

Commit

Permalink
node integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperf committed Dec 26, 2024
1 parent 57705dc commit 7a376f8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
Empty file added container/Dockerfile.node
Empty file.
37 changes: 35 additions & 2 deletions container/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

services:

php:
Expand All @@ -9,6 +7,13 @@ services:
volumes:
- ../site:/srv/www
- /tmp:/tmp
- node_binaries:/usr/local/node:ro # Added read-only flag
environment:
- PATH=/usr/local/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
networks:
- app-network
depends_on:
- node

nginx:
image: nginx:1.19.2
Expand All @@ -17,6 +22,10 @@ services:
- ./nginx/config/app.conf:/etc/nginx/conf.d/default.conf
ports:
- "8080:80"
networks:
- app-network
depends_on:
- php

db:
image: mariadb:10.5
Expand All @@ -29,5 +38,29 @@ services:
- "3307:3306"
volumes:
- ./db/data:/var/lib/mysql
networks:
- app-network

node:
build:
context: ../container/node
dockerfile: Dockerfile
volumes:
- ../site:/srv/www
- node_binaries:/usr/local/node
environment:
- PATH=/usr/local/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
tty: true
stdin_open: true
command: tail -f /dev/null
networks:
- app-network

volumes:
node_binaries:

networks:
app-network:
driver: bridge


23 changes: 23 additions & 0 deletions container/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:22

# Create directories
RUN mkdir -p /usr/local/node/bin && \
mkdir -p /usr/local/node/lib

# Install Yarn globally with force
RUN npm install -g yarn --force

# Copy node executable and libs
RUN cp /usr/local/bin/node /usr/local/node/bin/ && \
cp -r /usr/local/lib/node_modules /usr/local/node/lib/ && \
ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/node/bin/npm && \
ln -s ../lib/node_modules/yarn/bin/yarn.js /usr/local/node/bin/yarn && \
chmod +x /usr/local/node/bin/*

# Add our custom bin directory to PATH
ENV PATH=/usr/local/node/bin:$PATH

WORKDIR /srv/www/web

# Optional check
RUN node --version && npm --version && yarn --version

0 comments on commit 7a376f8

Please sign in to comment.