Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added docker-compose feature for nideshop #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:lts-alpine3.14
RUN mkdir -p /var/nideshop
COPY ./ /var/nideshop/
WORKDIR /var/nideshop
RUN sed -i 's/127.0.0.1/mysql/g' src/common/config/database.js
EXPOSE 8360/tcp
CMD ["npm","start"]
5 changes: 5 additions & 0 deletions Dockerfile.database
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mysql:5.7.35
RUN mkdir -p /var/dbconfig
COPY ./nideshop.sql /docker-entrypoint-initdb.d
ENV MYSQL_ROOT_PASSWORD 1
CMD ["mysqld"]
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.9" # optional since v1.27.0
services:
backend:
build:
context: .
dockerfile: ./Dockerfile.backend
ports:
- "18360:8360"
depends_on:
- mysql
mysql:
build:
context: .
dockerfile: ./Dockerfile.database
ports:
- "13306:3306"
volumes:
- "nideshop-mysql-db:/var/lib/mysql"
volumes:
nideshop-mysql-db: {}
2 changes: 2 additions & 0 deletions nideshop.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CREATE SCHEMA `nideshop` DEFAULT CHARACTER SET utf8mb4 ;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
use nideshop;

-- ----------------------------
-- Table structure for nideshop_ad
Expand Down
Empty file added run-docker.sh
Empty file.
2 changes: 1 addition & 1 deletion src/common/config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module.exports = {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: 'root',
password: '1',
dateStrings: true
};