docker run test
This commit is contained in:
parent
e93ed4f945
commit
32772117fe
1
.env.docker
Normal file
1
.env.docker
Normal file
@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL="postgresql://pjob:pjob@db:5432/pjob?schema=public"
|
20
docker-compose.yaml
Normal file
20
docker-compose.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
pjob:
|
||||||
|
build: ./pjob/
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 80:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=pjob
|
||||||
|
- POSTGRES_DB=pjob
|
||||||
|
- POSTGRES_PASSWORD=pjob
|
5
dockerfile
Normal file
5
dockerfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM node
|
||||||
|
WORKDIR /
|
||||||
|
COPY . /www/
|
||||||
|
CMD node /www/server/index.mjs
|
||||||
|
EXPOSE 3000
|
31
init.sql
Normal file
31
init.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Data" (
|
||||||
|
"id" SERIAL NOT NULL,
|
||||||
|
"desc" VARCHAR NOT NULL DEFAULT '',
|
||||||
|
"img" VARCHAR NOT NULL DEFAULT '/Pjob.jpb',
|
||||||
|
"time" VARCHAR NOT NULL DEFAULT '',
|
||||||
|
"pay" INTEGER NOT NULL DEFAULT 1,
|
||||||
|
|
||||||
|
CONSTRAINT "Data_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Job" (
|
||||||
|
"id" SERIAL NOT NULL,
|
||||||
|
"name" VARCHAR NOT NULL,
|
||||||
|
"worktime" VARCHAR NOT NULL,
|
||||||
|
"createTime" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updateTime" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"pin" BOOLEAN NOT NULL DEFAULT true,
|
||||||
|
"dataId" INTEGER,
|
||||||
|
"place" VARCHAR NOT NULL DEFAULT 'in',
|
||||||
|
"area" VARCHAR NOT NULL DEFAULT 'in',
|
||||||
|
|
||||||
|
CONSTRAINT "Job_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Job_dataId_key" ON "Job"("dataId");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Job" ADD CONSTRAINT "Job_dataId_fkey" FOREIGN KEY ("dataId") REFERENCES "Data"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
|
Loading…
Reference in New Issue
Block a user