-
Notifications
You must be signed in to change notification settings - Fork 0
Maxsibilla/issue 902 #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Maxsibilla/issue 902 #908
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
42aebc2
Creating new github action to build and push docker image
maxsibilla 6b9a37c
Modifying github actions to utilize shell script for docker build
maxsibilla 4aa65c3
Setting working-directory
maxsibilla 1fbc9c6
Updating paths
maxsibilla 059692d
Updating image tag
maxsibilla f1779ff
Updating image tag
maxsibilla 8f020a6
Adding version variable
maxsibilla 2949294
Adding version variable
maxsibilla 5124d9f
Adding version variable
maxsibilla 84c18b1
Reference variable properly
maxsibilla faed110
Reference variable properly
maxsibilla 739ba4a
Adding action to deploy docker image on remote server
maxsibilla 522f359
Creating new docker compose file to handle dev repository
maxsibilla 6050b9c
Adding AWS IP whitelist step
maxsibilla 91ab9e4
Adding AWS IP whitelist step
maxsibilla c5d059e
Modifying when removal of whitelist occurs
maxsibilla 9a96326
Updating ssh action version
maxsibilla e2a0f9f
Increasing ssh timeout
maxsibilla b787cb0
Combining all commands into a single line to run as codcc user
maxsibilla a1cce33
Updating known hosts on remote server
maxsibilla 59d4c3c
Updating known hosts on remote server
maxsibilla 03b92b5
Add use_insecure_cipher property
maxsibilla 15886b0
Making workflow async
maxsibilla b2b8635
making whitelist step same as deploy
maxsibilla 4116927
Merging whitelist cleanup job into deploy job, adding condition to en…
maxsibilla 7e2fd47
Potential fix for code scanning alert no. 7: Workflow does not contai…
maxsibilla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,79 @@ | ||
| name: Build and Deploy Docker Image on Dev | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - dev-integrate | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Create $ENTITY_API_VERSION | ||
| run: | | ||
| export ENTITY_API_VERSION=$(tr -d "\n\r" < ../VERSION | xargs) | ||
| echo "ENTITY_API_VERSION=$ENTITY_API_VERSION" >> $GITHUB_ENV | ||
| working-directory: ./docker | ||
|
|
||
| - name: Make build script executable | ||
| run: chmod +x ./docker-development.sh | ||
| working-directory: ./docker | ||
|
|
||
| - name: Run the Docker build shell script | ||
| run: ./docker-development.sh build | ||
| working-directory: ./docker | ||
|
|
||
| - name: Tag the Docker Image | ||
| # Alternatively we could use ${{ github.sha }} instead of latest | ||
| run: docker image tag sennet/entity-api:$ENTITY_API_VERSION sennet/entity-api-dev:latest | ||
| working-directory: ./docker | ||
|
|
||
| - name: Push the Docker image | ||
| run: docker push sennet/entity-api-dev:latest | ||
| working-directory: ./docker | ||
|
|
||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| needs: build-and-push | ||
| steps: | ||
| - name: Whitelist GitHub Actions IP | ||
| uses: bbharathkumarreddy/aws-whitelist-ip@v1.0 | ||
| with: | ||
| security-group-id: sg-0ddfcbe0a83a5266c | ||
| action: whitelist | ||
| port: 22 | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: us-east-1 | ||
| - name: Deploy to Server via SSH | ||
| uses: appleboy/ssh-action@v1 | ||
| with: | ||
| host: '${{ secrets.REMOTE_HOST }}' | ||
| username: ${{ secrets.REMOTE_USER }} | ||
| key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| use_insecure_cipher: true | ||
| script: | | ||
| # Change to codcc user on server | ||
| sudo su - codcc -c "cd /opt/sennet/entity-api/docker/; git pull; docker pull sennet/entity-api-dev:latest; ./docker-development.sh down; ./docker-development.sh start;" | ||
| - name: Remove GitHub Actions IP | ||
| uses: bbharathkumarreddy/aws-whitelist-ip@v1.0 | ||
| if: always() | ||
| with: | ||
| security-group-id: sg-0ddfcbe0a83a5266c | ||
| action: remove | ||
| port: 22 | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: us-east-1 | ||
|
||
This file contains hidden or 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,4 @@ | ||
| services: | ||
| entity-api: | ||
| # Use the published image and tag from DockerHub | ||
| image: sennet/entity-api-dev:latest |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.