-
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.
Delete unused dockerimages on autoredeploy #main
- Loading branch information
EliasKnudsen
committed
Apr 10, 2024
1 parent
692b01b
commit 1e6b5e8
Showing
2 changed files
with
54 additions
and
48 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 |
|---|---|---|
| @@ -1,32 +1,36 @@ | ||
| name: Server auto deploy | ||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| push: | ||
| branches: ["main"] | ||
|
|
||
| jobs: | ||
| docker-build: | ||
| strategy: | ||
| matrix: | ||
| node-version: [20.x] | ||
| runs-on: self-hosted | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Create .env files | ||
| run: | | ||
| # Create .env with all variables except HOST_URL Backend | ||
| echo "HOST=${{ vars.HOST }}" >> .env | ||
| echo "PORT=${{ vars.PORT }}" >> .env | ||
| echo "DATABASE_CLIENT=${{ vars.DATABASE_CLIENT }}" >> .env | ||
| echo "DATABASE_FILENAME=${{ vars.DATABASE_FILENAME }}" >> .env | ||
| echo "ADMIN_JWT_SECRET=${{ secrets.ADMIN_JWT_SECRET }}" >> .env | ||
| echo "API_TOKEN_SALT=${{ secrets.API_TOKEN_SALT }}" >> .env | ||
| echo "APP_KEYS=${{ secrets.APP_KEYS }}" >> .env | ||
| echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env | ||
| echo "TRANSFER_TOKEN_SALT=${{ secrets.TRANSFER_TOKEN_SALT }}" >> .env | ||
| # Create .env.production with HOST_URL Frontend | ||
| echo "INTERNAL_STRAPI_URL=${{ vars.INTERNAL_STRAPI_URL }}" >> .env.production | ||
| echo "OUTSIDE_STRAPI_URL=${{ vars.OUTSIDE_STRAPI_URL }}" >> .env.production | ||
| - name: Docker build | ||
| run: docker-compose build | ||
| - name: Docker up | ||
| run: docker-compose up -d | ||
| docker-build: | ||
| strategy: | ||
| matrix: | ||
| node-version: [20.x] | ||
| runs-on: self-hosted | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Remove old Docker images | ||
| run: | | ||
| docker rmi $(docker images -q backend:outreach) || true | ||
| docker rmi $(docker images -q frontend:outreach) || true | ||
| - name: Create .env files | ||
| run: | | ||
| # Create .env with all variables except HOST_URL Backend | ||
| echo "HOST=${{ vars.HOST }}" >> .env | ||
| echo "PORT=${{ vars.PORT }}" >> .env | ||
| echo "DATABASE_CLIENT=${{ vars.DATABASE_CLIENT }}" >> .env | ||
| echo "DATABASE_FILENAME=${{ vars.DATABASE_FILENAME }}" >> .env | ||
| echo "ADMIN_JWT_SECRET=${{ secrets.ADMIN_JWT_SECRET }}" >> .env | ||
| echo "API_TOKEN_SALT=${{ secrets.API_TOKEN_SALT }}" >> .env | ||
| echo "APP_KEYS=${{ secrets.APP_KEYS }}" >> .env | ||
| echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env | ||
| echo "TRANSFER_TOKEN_SALT=${{ secrets.TRANSFER_TOKEN_SALT }}" >> .env | ||
| # Create .env.production with HOST_URL Frontend | ||
| echo "INTERNAL_STRAPI_URL=${{ vars.INTERNAL_STRAPI_URL }}" >> .env.production | ||
| echo "OUTSIDE_STRAPI_URL=${{ vars.OUTSIDE_STRAPI_URL }}" >> .env.production | ||
| - name: Docker build | ||
| run: docker-compose build | ||
| - name: Docker up | ||
| run: docker-compose up -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 |
|---|---|---|
| @@ -1,23 +1,25 @@ | ||
| version: "3.3" | ||
| services: | ||
| backend: | ||
| restart: unless-stopped | ||
| volumes: | ||
| - type: bind | ||
| source: /var/data/ | ||
| target: /var/data/ | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-backend | ||
| ports: | ||
| - "1337:1337" | ||
| environment: | ||
| - NODE_ENV=production | ||
| backend: | ||
| restart: unless-stopped | ||
| volumes: | ||
| - type: bind | ||
| source: /var/data/ | ||
| target: /var/data/ | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-backend | ||
| image: backend:outreach | ||
| ports: | ||
| - "1337:1337" | ||
| environment: | ||
| - NODE_ENV=production | ||
|
|
||
| frontend: | ||
| restart: unless-stopped | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-frontend | ||
| ports: | ||
| - "3000:3000" | ||
| frontend: | ||
| restart: unless-stopped | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile-frontend | ||
| image: frontend:outreach | ||
| ports: | ||
| - "3000:3000" |