diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..f699222 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,7 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.git +database.sqlite diff --git a/backend/Dockerfile b/backend/Dockerfile index 5349d69..9484f1e 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -5,12 +5,7 @@ COPY package.json package-lock.json ./ RUN npm ci COPY . . -ENV FRONTEND_ORIGIN=http://localhost:8000 -ENV PORT=8001 - EXPOSE $PORT - RUN npx sequelize db:migrate -RUN echo "Migration complete." CMD ["node", "index.js"] diff --git a/backend/config/config.json b/backend/config/config.json index 2e63261..32f9227 100644 --- a/backend/config/config.json +++ b/backend/config/config.json @@ -1,14 +1,14 @@ { "development": { "dialect": "sqlite", - "storage": "database.sqlite" + "storage": "database/database.sqlite" }, "test": { "dialect": "sqlite", - "storage": "database.test.sqlite" + "storage": "database/database.sqlite" }, "production": { "dialect": "sqlite", - "storage": "database.production.sqlite" + "storage": "database/database.sqlite" } } diff --git a/backend/index.js b/backend/index.js index 5ed8bfc..6b53c44 100644 --- a/backend/index.js +++ b/backend/index.js @@ -21,7 +21,7 @@ app.use(express.static(path.join(__dirname, 'public'))); // init sequalize const sequelize = new Sequelize({ dialect: 'sqlite', - storage: 'database.sqlite', + storage: 'database/database.sqlite', }); // "/" diff --git a/docker-compose.yaml b/docker-compose.yaml index 1dddca6..e27c12e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,14 +1,31 @@ -version: '3' +version: '3.8' + services: - frontend: - build: - context: ./frontend - ports: - - '8000:8000' - depends_on: - - backend backend: + image: unittcms-backend:latest build: context: ./backend ports: - '8001:8001' + environment: + - NODE_ENV=production + - FRONTEND_ORIGIN=http://localhost:8000 + - PORT=8001 + volumes: + - db-data:/app/database + + frontend: + image: unittcms-frontend:latest + build: + context: ./frontend + ports: + - '8000:8000' + environment: + - NODE_ENV=production + - NEXT_PUBLIC_BACKEND_ORIGIN=http://localhost:8001 + - PORT=8000 + depends_on: + - backend + +volumes: + db-data: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 53782ac..0db520c 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -38,7 +38,6 @@ RUN \ FROM base AS runner WORKDIR /app -ENV NODE_ENV production # Uncomment the following line in case you want to disable telemetry during runtime. # ENV NEXT_TELEMETRY_DISABLED 1 @@ -60,8 +59,6 @@ USER nextjs EXPOSE 8000 -ENV PORT 8000 - # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output CMD HOSTNAME="0.0.0.0" node server.js \ No newline at end of file