-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08b636e
commit 3eb95c9
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DATABASE_PORT= | ||
DATABASE_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI/CD | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build_and_deploy: | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout main | ||
uses: actions/checkout@main | ||
- name: Replace tokens | ||
uses: cschleiden/replace-tokens@v1.1 | ||
with: | ||
tokenPrefix: '#{' | ||
tokenSuffix: '}#' | ||
files: '["docker-compose.production.yaml"]' | ||
env: | ||
DATABASE_PORT: "${{ secrets.DATABASE_PORT }}" | ||
DATABASE_PASSWORD: "${{ secrets.DATABASE_PASSWORD }}" | ||
- name: Copy docker compose file via SSH password | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
password: ${{ secrets.SERVER_PASSWORD }} | ||
port: 22 | ||
source: "docker-compose.production.yaml" | ||
target: "~/Projects/slobodanemacenu/" | ||
- name: Starting docker compose file via SSH | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
password: ${{ secrets.SERVER_PASSWORD }} | ||
port: 22 | ||
script: docker compose -f ~/Projects/slobodanemacenu/docker-compose.production.yaml up --build -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.9" | ||
|
||
services: | ||
database: | ||
image: mcr.microsoft.com/mssql/server:2022-latest | ||
container_name: "slobodanemacenu_database" | ||
user: root | ||
ports: | ||
- "#{DATABASE_PORT}#:1433" | ||
environment: | ||
- ACCEPT_EULA=Y | ||
- MSSQL_SA_PASSWORD=#{DATABASE_PASSWORD}# | ||
volumes: | ||
- slobodanemacenu_database_data:/var/opt/mssql/data | ||
restart: always | ||
env_file: | ||
- .env | ||
volumes: | ||
slobodanemacenu_database_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.9" | ||
|
||
services: | ||
database: | ||
image: mcr.microsoft.com/mssql/server:2022-latest | ||
container_name: "slobodanemacenu_database" | ||
user: root | ||
ports: | ||
- "${DATABASE_PORT}:1433" | ||
environment: | ||
- ACCEPT_EULA=Y | ||
- MSSQL_SA_PASSWORD=${DATABASE_PASSWORD} | ||
volumes: | ||
- slobodanemacenu_database_data:/var/opt/mssql/data | ||
restart: always | ||
env_file: | ||
- .env | ||
volumes: | ||
slobodanemacenu_database_data: |