diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..94a1079 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +tech-assignment-data +node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6968709 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:20-bookworm-slim +LABEL authors="werring" + +WORKDIR /usr/src/app + +COPY package*.json . + +RUN npm ci + +COPY . . + +EXPOSE 3000 + +CMD ["npm", "run", "start:prod"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a65b4ac --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +services: + api: + build: . + ports: + - "3001:3000" + command: "npm run start:dev" + database: + image: "mysql:8" + command: --default-authentication-plugin=mysql_native_password + restart: always + environment: + MYSQL_ROOT_PASSWORD: myfreight + ports: + - 13306:3306 + volumes: + - "./database/lib:/var/lib/mysql" + - "./database/entrypoint:/docker-entrypoint-initdb.d"