Skip to content

Instantly share code, notes, and snippets.

@AliKhadivi
Last active August 27, 2023 06:00
Show Gist options
  • Save AliKhadivi/7d662f0867b1a89e6328828078a5c6a8 to your computer and use it in GitHub Desktop.
Save AliKhadivi/7d662f0867b1a89e6328828078a5c6a8 to your computer and use it in GitHub Desktop.
FROM ubuntu:20.04
# Install prerequistes since it is needed to get repo config for SQL server
USER root
ENV ACCEPT_EULA=Y \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -yq curl apt-transport-https gnupg2 && \
# Get official Microsoft repository configuration
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | tee /etc/apt/sources.list.d/msprod.list && \
apt-get update && \
# Install SQL Server from apt
apt-get install -y mssql-server && \
# Install optional packages
apt-get install -y mssql-server-ha mssql-server-fts mssql-server-polybase && \
# Install SQL Server Tools from apt
apt-get install -y mssql-tools unixodbc-dev && \
# Cleanup the Dockerfile
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists
ENV PATH="${PATH}:/opt/mssql-tools/bin"
EXPOSE 1433
USER mssql
# Run SQL Server process
CMD ["/opt/mssql/bin/sqlservr"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment