Holla,
I am new to Docker and I have spent two days on it, but I still haven’t found how to solve my problem.
I have a TrueNAS server at home and I want to host my Discord bot (JS) on it.
I have specified on my TrueNAS the repo image that is requested, but when I launch the application on the TrueNAS, the bot connects to Discord without problem, except that my MySQL and my phpMyAdmin are not in the repo.
So I don’t know how to do it.
My bot needs a database, so I have to make sure that I have in the repo image, my bot, my MySQL and my phpMyAdmin.
How to do it please?
Thanks.
dockerfile:
FROM node:18-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
RUN npm install && npm cache clean --force
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
docker-composer:
version: "3.9"
services:
bot:
build: .
container_name: costa-rosta-bot
restart: always
environment:
- NODE_ENV=production
depends_on:
- mysql
networks:
- costa-rosta-network
volumes:
- .:/usr/src/app
command: ["node", "index.js"]
mysql:
image: mysql:8.0
container_name: costa-rosta-mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: costa_rosta
networks:
- costa-rosta-network
ports:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: costa-rosta-phpmyadmin
restart: always
environment:
PMA_HOST: mysql
PMA_USER: root
PMA_PASSWORD: root_password
ports:
- "8080:80"
networks:
- costa-rosta-network
depends_on:
- mysql
networks:
costa-rosta-network:
driver: bridge
volumes:
mysql-data:
driver: local