I'm trying to "dockerize" my webserver. It was working fine running normaly, but I can't make it work with docker-compose.
Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["TokenLabCalendar/TokenLabCalendar.csproj", "TokenLabCalendar/"]
RUN dotnet restore "TokenLabCalendar/TokenLabCalendar.csproj"
COPY . .
WORKDIR "/src/TokenLabCalendar"
RUN dotnet build "TokenLabCalendar.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "TokenLabCalendar.csproj" -c Release -o /app
FROM base AS final
COPY . /app
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "TokenLabCalendar.dll"]
docker-compose.yml
version: '3.4'
services:
tokenlabcalendar:
image: ${DOCKER_REGISTRY-}tokenlabcalendar
build:
context: .
dockerfile: TokenLabCalendar/Dockerfile
environment:
- DBHOST:mysql
depends_on:
- mysql
mysql:
container_name: calendariodb
image: mysql/mysql-server:latest
restart: always
volumes:
- dbvol:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
env_file:
- secrets.env
volumes:
appbuild:
dbvol:
Every time I make a request to de database I got this error. There is no table in the database.
MySql.Data.MySqlClient.MySqlException (0x80004005): Table 'calendario.AspNetUsers' doesn't exist ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Table 'calendario.AspNetUsers' doesn't exist
I don't know if I need to rerun the migration and update the database before it runs. Any help?
User contributions licensed under CC BY-SA 3.0