diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..62c1513 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +node_modules + +npm-debug.log + +Dockerfile + +.dockerignore + +.env + diff --git a/.gitignore b/.gitignore index c6bba59..770bfe2 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,7 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# idea + +./.idea \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1a1c01b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:18 + +WORKDIR /usr/src/app + +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . . + +EXPOSE 3000 + +CMD ["node", "src/server.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8951fb8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: "3.8" + +services: + afos-api: + build: + context: . + dockerfile: Dockerfile + ports: + - 3000:3000 + volumes: + - .:/src + environment: + - NODE_ENV=production + - PORT=3000 + - DB_HOST=mysql + - DB_USER=afos + - DB_PASSWORD=afosS3cure!Passw@rd + - DB_NAME=afosdb + - JWT_SECRET=afos-secret + depends_on: + - mysql + + mysql: + image: mysql:8.0 + container_name: mysql-container + environment: + MYSQL_ROOT_PASSWORD: passw@rd + MYSQL_DATABASE: afosdb + volumes: + - mysql_data:/var/lib/mysql + +volumes: + mysql_data: