As the title says, I'm having trouble using argon2
when I'm running Docker on my Windows 10 machine.
Dockerfile:
FROM node:16.13.1
WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
CMD npm start
.dockerignore:
.git
docker-compose.yml
.env.example
.gitlab-ci.yml
Makefile
.vscode
tmp
_Production
# Log files
npm-debug.log*
# Dependency directories
node_modules
/node_modules
npm-debug.log
# Coverage files
coverage
.nyc_output
# Documentation files
/docs
README.md
Example.ts:
import { Request, Response } from "express";
import { getRepository } from "typeorm";
import { User } from "../entity/user.entity";
import * as argon2 from "argon2";
export const Register = async (req: Request, res: Response) => {
const { body } = req as any;
if (body.password !== body.password_confirm) {
return res.status(400).send({
message: "Passwords do not match",
});
}
const user = await getRepository(User).save({
email: body.email,
password: await argon2.hash(body.password),
});
return res.status(201).send(user);
};
docker-compose.yaml
version: '20.10.13'
services:
backend:
build: .
ports:
- "8000:8000"
volumes:
- .:/app
depends_on:
- db
db:
image: mysql:8
restart: always
environment:
MYSQL_DATABASE: ambassador
MYSQL_ROOT_PASSWORD: root
volumes:
- .dbdata:/var/lib/mysql
ports:
- "33066:3306"
As you can see I already exclude node_modules
in the .dockerignore
. Help is appreciated.