Skip to content

Commit

Permalink
Merge pull request #202 from tSQLt-org/VSCCI
Browse files Browse the repository at this point in the history
Created devcontainer environment for development and fixed CI pipeline accordingly.
  • Loading branch information
lizbaron authored Dec 7, 2024
2 parents ecf1ae2 + 12532f4 commit 4a921d0
Show file tree
Hide file tree
Showing 174 changed files with 4,916 additions and 7,770 deletions.
67 changes: 67 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Use the specified image as the base
FROM mcr.microsoft.com/devcontainers/base:bullseye

# Set environment variables, if any
# ENV MY_ENV_VAR=my_value

# Run package updates and install packages
RUN apt-get update


CMD code --install-extension ms-mssql.mssql

USER vscode
RUN curl https://run.spawn.cc/install | sh
ENV PATH="/home/vscode/.spawnctl/bin:$PATH"

USER root
RUN apt-get update && apt-get install -y curl gnupg software-properties-common \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list \
&& apt-get update \
&& apt-get install -y gh

RUN apt-get update && \
apt-get install -y mono-complete

ENV TSQLTCERTPATH /var/tSQLtCertTemp
ENV TSQLTCERTPASSWORD P@ssw0rdP@ssw0rdP@ssw0rdP@ssw0rd
RUN mkdir -p $TSQLTCERTPATH && \
chmod 777 $TSQLTCERTPATH

# Add the Microsoft SQL Server repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/msprod.list

RUN apt-get update
ENV ACCEPT_EULA=Y
RUN apt-get install -y mssql-tools unixodbc-dev
ENV PATH="$PATH:/opt/mssql-tools/bin"

RUN apt-get install -y unzip

RUN curl -L https://aka.ms/sqlpackage-linux -o sqlpackage.zip \
&& unzip sqlpackage.zip -d /opt/sqlpackage \
&& chmod +x /opt/sqlpackage/sqlpackage \
&& rm sqlpackage.zip
ENV PATH="$PATH:/opt/sqlpackage"

RUN apt-get install -y wget apt-transport-https software-properties-common && \
wget -q "https://packages.microsoft.com/config/debian/$(. /etc/os-release && echo $VERSION_ID)/packages-microsoft-prod.deb" -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
apt-get install -y powershell

RUN pwsh -Command "Install-Module -Name SqlServer -Scope AllUsers -AllowClobber -Force"

RUN pwsh -Command "Install-Module -Name Az -AllowClobber -Scope AllUsers -Force"
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 \
&& chmod +x ./bicep \
&& mv ./bicep /usr/local/bin/bicep

# Set the default shell to PowerShell
SHELL ["pwsh", "-Command"]


69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
{
"name": "Docker in Docker",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
//"image": "mcr.microsoft.com/devcontainers/base:bullseye",
//"image": "mcr.microsoft.com/mssql/server:2022-latest",
// "image": "mcr.microsoft.com/devcontainers/base:bullseye",
"build": {
// Path is relataive to the devcontainer.json file.
"dockerfile": "Dockerfile"
},

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": "true"
},
// "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/dotnet:1": {},
"ghcr.io/devcontainers/features/git:1": {},
// "ghcr.io/devcontainers/features/git-lfs:1": {},
// "ghcr.io/devcontainers/features/github-cli:1": {},
// "ghcr.io/devcontainers/features/go:1": {},
// "ghcr.io/devcontainers/features/powershell:1": {},
// "ghcr.io/devcontainers/features/python:1": {},
},

// Use this environment variable if you need to bind mount your local source code into a new container.
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],

"customizations": {
"vscode": {
"settings": {
"remote.autoForwardPorts": false
},
"extensions": [
"ms-mssql.mssql",
"redhat.vscode-yaml",
"ms-vscode.powershell",
"ms-azuretools.vscode-docker",
"ms-mssql.sql-bindings-vscode",
"ms-mssql.sql-database-projects-vscode",
"ms-mssql.data-workspace-vscode",
"github.vscode-github-actions",
"ms-dotnettools.csdevkit",
"ms-vscode.powershell",
"ms-azuretools.vscode-bicep",
]
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ["/bin/sh", "-c", "whoami && pwd && chmod 777 ./.devcontainer/postCreateCommand.sh && ./.devcontainer/postCreateCommand.sh"], //

// Use 'postStartCommand' to run commands after the container is created.
"postStartCommand": ["/bin/sh", "-c", "whoami && pwd && chmod 777 ./.devcontainer/postStartCommand.sh && ./.devcontainer/postStartCommand.sh"], //

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}


11 changes: 11 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cd "$(dirname "$0")"

docker --version
docker-compose -f sqlserver.yml up -d --force-recreate

cd "$TSQLTCERTPATH"
openssl req -x509 -newkey rsa:4096 -keyout tSQLtOfficialSigningKey.key -out tSQLtOfficialSigningKey.crt -days 365 -nodes -subj "/CN=yourdomain.com"
openssl pkcs12 -export -out tSQLtOfficialSigningKey.pfx -inkey tSQLtOfficialSigningKey.key -in tSQLtOfficialSigningKey.crt -passout pass:"$TSQLTCERTPASSWORD"


# pwsh -File ../tSQLt/PrepareServer.ps1
4 changes: 4 additions & 0 deletions .devcontainer/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd "$(dirname "$0")"

docker --version
docker-compose -f sqlserver.yml up -d
9 changes: 9 additions & 0 deletions .devcontainer/sqlserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"
services:
sql_server:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- "1433:1433"
environment:
ACCEPT_EULA: 'Y'
MSSQL_SA_PASSWORD: 'P@ssw0rd'
30 changes: 30 additions & 0 deletions .devcontainer/tSQLtOfficialSigningKey.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFEzCCAvugAwIBAgIUA+19JzEdOm4/g23a0HCbrZuMPGMwDQYJKoZIhvcNAQEL
BQAwGTEXMBUGA1UEAwwOeW91cmRvbWFpbi5jb20wHhcNMjMxMjAxMjAxMzA5WhcN
MjQxMTMwMjAxMzA5WjAZMRcwFQYDVQQDDA55b3VyZG9tYWluLmNvbTCCAiIwDQYJ
KoZIhvcNAQEBBQADggIPADCCAgoCggIBAOss5YSKp/ARdrfH7M20JT6y8KvX0iIj
26oMM/JgeAvzNHt7CRnneVtJQpQTpfT0ugskolBV/XHGJ+3bOdnTsDiWea6dZ7zq
SOIB0T3R+dA3EDFNUaVysVvrKzLU/GZL9RsZpMyvNUoChcL7UyTp+RWvS0reFCtp
wpoLsrE0YCFckoDCFiKFivdLg/eESJyeR6W3fq+8XrlqZ2Vin+FbukH/eTC3aoUO
s9z25K6v8nDn4EwqgDGdPyyU4EqnFy5oxEWwd1YoGQjXbGXTVZ6L8nUySadr8yXh
DAc2Orsd0RN5r6vJJFDbxbab0mYayyq7ZfoGjKVbgUS2jZHMpDUhgnTjXD+oI7PV
TrIqnY0pRTzh8xVOgFQP8H5J9aIS/tZDvImItmZ9MR1w/PoXt4VHd7nR8NMG/68I
f9CXSj3Fza+bCw3az+PTd04BC14kxXMPfRahu2KB4TZJBOQeTRJaB0aq8Lo1hZE0
R6Amds3ouMo0jRww1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tSQLtOfficialSigningKey.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDrLOWEiqfwEXa3
x+zNtCU+svCr19IiI9uqDDPyYHgL8zR7ewkZ53lbSUKUE6X09LoLJKJQVf1xxift
2znZ07A4lnmunWe86kjiAdE90fnQNxAxTVGlcrFb6ysy1PxmS/UbGaTMrzVKAoXC
+1Mk6fkVr0tK3hQracKaC7KxNGAhXJKAwhYihYr3S4P3hEicnkelt36vvF65amdl
Yp/hW7pB/3kwt2qFDrPc9uSur/Jw5+BMKoAxnT8slOBKpxcuaMRFsHdWKBkI12xl
01Wei/J1Mkmna/Ml4QwHNjq7HdETea+rySRQ28W2m9JmGssqu2X6BoylW4FEto2R
zKQ1IYJ041w/qCOz1U6yKp2NKUU84fMVToBUD/B+SfWiEv7WQ7yJiLZmfTEdcPz6
F7eFR3e50fDTBv+vCH/Ql0o9xc2vmwsN2s/j03dOAQteJMVzD30WobtigeE2SQTk
Hk0SWgdGqvC6NYWRNEegJnbN6LjKNI0cMNSydq+wi0UadAl0Z/sQ93tRo3BUK1uL
yk40fu30syZqW5dBn174nCQcS1EsenyK9XhMxCMuc3mYtoCvkmfM8CKDdcSypxA9
lmNn2LqbrsNQrBvrz+tdPO5iXNVgmRmkz9okIH6e/z/lgKc2zOEb7W3ptSvSbavx
fhBx1STmV6rOdP/i7nM/A4LwVlebMQIDAQABAoICAHdqfskEly4B0CSV8hqpxNfH
iQnZNyx6xMneFGqYrZxzzEx/NyneLfM6igIiz/xIYEfUPE9Kur0Q/6l5zjBbm3nA
ft05tDlrRcLtZVBc1NrzetduCW1XhdPE4FSZbeiL3VP7e4Er3oVMLpvJfniaDg8C
ydqkVd2NgHE0S3JLxBxsoz+aTh8NbHkR8Vq34x8UCBGP0VZu8jJ4YzRKFiEasMNe
dC1WlVInGxGylIBXe2X1eCF0209WJ4P9vL5rhgvc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SkGOC0tuv2MAkKZUYd+wXS1WTI
11bvPI4fB5GVVMDLhPFgNyqPTwE4oJg=
-----END PRIVATE KEY-----
Binary file added .devcontainer/tSQLtOfficialSigningKey.pfx
Binary file not shown.
59 changes: 0 additions & 59 deletions Build/Build.ps1

This file was deleted.

Loading

0 comments on commit 4a921d0

Please sign in to comment.