Skip to content

Commit

Permalink
Merge pull request #157 from phuuthanh-dev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
phuuthanh-dev authored Aug 25, 2024
2 parents 1dc7396 + 58b72ed commit 7fbbd1c
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 306 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,6 @@ jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- "1433:1433"
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${{ secrets.SQL_SA_PASSWORD }}
MSSQL_PID: Express

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

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Execute init.sql
run: |
sqlcmd -S localhost -U sa -P ${{ secrets.SQL_SA_PASSWORD }} -i db/init.sql
- name: Run Unit Tests
run: mvn test

- name: Run Integration Tests
run: mvn verify

build:
name: Build
needs: run-tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
Expand Down
21 changes: 10 additions & 11 deletions db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Dùng official SQL Server 2019 image của Microsoft
FROM mcr.microsoft.com/mssql/server:2019-latest
# Use the official MySQL image
FROM mysql:8.2.0

# Copy the SQL script vào container
COPY init.sql /usr/src/app/init.sql
# Set environment variables for MySQL
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes
ENV MYSQL_DATABASE=DB_AUCTION
ENV MYSQL_COLLATION=utf8mb4_general_ci

# Chạy lệnh trong file sql
RUN /opt/mssql/bin/sqlservr & sleep 30 \
&& /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Thanhth@nh1 -i /usr/src/app/init.sql \
&& pkill sqlservr
# Copy the SQL script into the container
COPY init.sql /docker-entrypoint-initdb.d/init.sql

EXPOSE 1433
# Khởi động sql server
CMD ["/opt/mssql/bin/sqlservr"]
# Expose MySQL port
EXPOSE 3306
Loading

0 comments on commit 7fbbd1c

Please sign in to comment.