Skip to content

Commit

Permalink
Merge pull request #1075 from j2gg0s/ci-use-custom-mssql-image-in-wor…
Browse files Browse the repository at this point in the history
…kflow

ci: use custom mssql image in workflow to slove tls error
  • Loading branch information
j2gg0s authored Nov 22, 2024
2 parents 7e826e0 + 1aa1b7f commit 993ae63
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ jobs:
--health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s
--health-retries=5
mssql2019:
image: mcmoe/mssqldocker:v2019.CU4.0
image: ghcr.io/uptrace/mssql:latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: passWORD1
MYSQL_SA_PASSWORD: passWORD1
MSSQL_DB: test
MSSQL_USER: sa
MSSQL_PASSWORD: passWORD1
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/mssql-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Image for MSSQL

on:
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
working-directory: internal/dbtest/mssql-docker
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/mssql:latest .
# 推送镜像到 GHCR
- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository_owner }}/mssql:latest
11 changes: 7 additions & 4 deletions internal/dbtest/mssql-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM mcr.microsoft.com/mssql/server:2019-CU29-ubuntu-20.04

RUN openssl req -x509 -nodes -newkey rsa:2048 -subj '/CN=mssql' -addext "subjectAltName = DNS:mssql" -keyout /etc/ssl/private/mssql.key -out /etc/ssl/certs/mssql.pem -days 7 --set_serial 01
RUN chmod 400 /etc/ssl/private/mssql.key
RUN chmod 400 /etc/ssl/certs/mssql.pem
RUN mkdir -p /var/opt/mssql
RUN openssl req -x509 -nodes -newkey rsa:2048 \
-subj '/CN=mssql' -addext "subjectAltName = DNS:mssql" \
-keyout /var/opt/mssql/mssql.key -out /var/opt/mssql/mssql.pem \
-days 7 -set_serial 01
RUN chmod 400 /var/opt/mssql/mssql.key && \
chmod 400 /var/opt/mssql/mssql.pem
COPY mssql.conf /var/opt/mssql/mssql.conf


# Create a config directory
RUN mkdir -p /usr/config
WORKDIR /usr/config
Expand All @@ -15,3 +17,4 @@ WORKDIR /usr/config
COPY . /usr/config

ENTRYPOINT ["./entrypoint.sh"]

4 changes: 2 additions & 2 deletions internal/dbtest/mssql-docker/mssql.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[network]
tlscert = /etc/ssl/certs/mssql.pem
tlskey = /etc/ssl/private/mssql.key
tlscert = /var/opt/mssql/mssql.pem
tlskey = /var/opt/mssql/mssql.key
tlsprotocols = 1.2
forceencryption = 1

0 comments on commit 993ae63

Please sign in to comment.