Skip to content

Based on the latest SQL server docker image, this image has the tools necessary to deploy your DacPac files to your SQL docker containers. This image is intended to be used temporarily as part of your build process. Please review the example below.

License

Notifications You must be signed in to change notification settings

ikemtz/SQL_Dacpac

Repository files navigation

Docker Pulls

SQL Dacpac

Based on the latest SQL server docker image, this image has the tools necessary to deploy your DacPac files to your SQL docker containers. This image is intended to be used temporarily as part of your build process. Please review the example below.

Example Usage

FROM ikemtz/sql_dacpac:latest as sql-temp
ENV SA_PASSWORD=YOUR_DESIRED_PASSWORD \
    ACCEPT_EULA=Y \
    NEW_DB_NAME=YOUR_NEW_DATABASE_NAME

COPY *.dacpac /dacpac/
RUN sqlservr & sleep 20 \
    && sqlpackage /Action:Publish \
        /SourceTrustServerCertificate:true \
        /TargetTrustServerCertificate:true \
        /TargetServerName:localhost \
        /TargetUser:sa \
        /TargetPassword:$SA_PASSWORD \
        /SourceFile:/dacpac/db.dacpac \
        /TargetDatabaseName:$NEW_DB_NAME \
        /p:BlockOnPossibleDataLoss=false \
    && sleep 20 \
    && pkill sqlservr && sleep 10

FROM mcr.microsoft.com/mssql/server:2019-latest
LABEL author="@IkeMtz"
ENV SA_PASSWORD=YOUR_DESIRED_PASSWORD \
    ACCEPT_EULA=Y \
    NEW_DB_NAME=YOUR_NEW_DATABASE_NAME
EXPOSE 1433
COPY --from=sql-temp /var/opt/mssql/data/$NEW_DB_NAME*.mdf /var/opt/mssql/data/
COPY --from=sql-temp /var/opt/mssql/data/$NEW_DB_NAME*.ldf /var/opt/mssql/data/

About

Based on the latest SQL server docker image, this image has the tools necessary to deploy your DacPac files to your SQL docker containers. This image is intended to be used temporarily as part of your build process. Please review the example below.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published