Skip to content

Commit

Permalink
devcontainer: Update volumes to include /code/node_modules and /code/…
Browse files Browse the repository at this point in the history
…functions/node_modules to ensure dependencies are available in the container
  • Loading branch information
hakatashi committed Oct 8, 2024
1 parent 6543656 commit f1c4c70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ services:
build: slackbot
volumes:
- ..:/code
- /code/node_modules
- /code/functions/node_modules
stdin_open: true
tty: true
command: sh -c "echo hoge"
command: sleep infinity
environment:
- TEAM_ID=${TEAM_ID}
- SIGNING_SECRET=${SIGNING_SECRET}
Expand Down
16 changes: 0 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "slackbot",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "true"
}
},
Expand All @@ -27,24 +25,10 @@
"tunnel"
],
"postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1",
"onCreateCommand": "cp -RTf ~/.cache/slackbot/node_modules /code/node_modules && cp -RTf ~/.cache/slackbot-functions/node_modules /code/functions/node_modules",
"postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'",
"postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'",
"initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'",
"updateContentCommand": "echo 'updateContent: Please run `docker-compose up` to start the services.'"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
11 changes: 2 additions & 9 deletions .devcontainer/slackbot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@ FROM node:20-bookworm
RUN apt-get update -y && \
apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \
apt-get install git bash -y && \
mkdir -p /code/functions && \
mkdir -p ~/.cache/slackbot/node_modules && \
mkdir -p ~/.cache/slackbot-functions/node_modules && \
git clone https://github.com/tsg-ut/slackbot.git --branch master --single-branch --recursive --depth 1 /code && \
cd /code && \
ln -s ~/.cache/slackbot/node_modules node_modules && \
ln -s ~/.cache/slackbot-functions/node_modules functions/node_modules && \
wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package.json && \
wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package-lock.json && \
wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package.json -O functions/package.json && \
wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package-lock.json -O functions/package-lock.json && \
npm install --ignore-scripts && \
npm install --ignore-scripts --prefix functions && \
npm install && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand Down

0 comments on commit f1c4c70

Please sign in to comment.