diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dbecafc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM luchenqun/ubuntu-mysql-node +LABEL maintainer="luchenqun@qq.com" + +RUN mkdir -p /app +COPY src /app/src +COPY view /app/view +COPY www /app/www +COPY package.json /app/package.json +COPY production.js /app/production.js +COPY schema.sql /app/schema.sql + +WORKDIR /app +RUN npm install && service mysql start && mysql -u root < /app/schema.sql + +EXPOSE 3306 +EXPOSE 2000 +CMD ["node production.js"] \ No newline at end of file diff --git a/schema.sql b/schema.sql index eb629c9..e22af82 100644 --- a/schema.sql +++ b/schema.sql @@ -1,3 +1,9 @@ +CREATE USER 'test'@'127.0.0.1' IDENTIFIED BY '123456'; -- 创建一个以用户名为test,密码为123456的用户 +GRANT ALL ON *.* TO 'test'@'%'; -- 给刚创建的test用户数据库所有的权限 + +CREATE DATABASE mybookmarks DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -- 创建mybookmarks数据库 +USE mybookmarks; + -- 用户信息表 drop table if exists users; CREATE TABLE `users` (