Skip to content

Commit 8fa08aa

Browse files
authored
Merge pull request #244 from ngageoint/dev-actions
Dev actions
2 parents 716f5b8 + fc8b0e6 commit 8fa08aa

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
**/node_modules
22
**/dist
3-
**/lib
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: AWS Dev Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- test
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repo
18+
uses: actions/checkout@v4
19+
20+
- name: Set IMAGE_TAG
21+
run: |
22+
if [[ "${{ github.ref_name }}" == "test" ]]; then
23+
echo "IMAGE_TAG=test" >> $GITHUB_ENV
24+
else
25+
echo "IMAGE_TAG=dev" >> $GITHUB_ENV
26+
fi
27+
28+
- name: AWS config
29+
uses: aws-actions/configure-aws-credentials@v3
30+
with:
31+
role-to-assume: ${{ secrets.AWS_DEV_ROLE }}
32+
role-session-name: GithubNGAGeointSession
33+
aws-region: ${{ secrets.AWS_DEV_REGION }}
34+
35+
- name: AWS ECR Login
36+
id: ecr-login
37+
uses: aws-actions/amazon-ecr-login@v2
38+
39+
- name: Build Docker image and push
40+
env:
41+
REGISTRY: ${{ steps.ecr-login.outputs.registry }}
42+
REPOSITORY: "/mage/server"
43+
IMAGE_TAG: ${{ env.IMAGE_TAG }}
44+
run: |
45+
docker build -t $REGISTRY$REPOSITORY:$IMAGE_TAG .
46+
docker push $REGISTRY$REPOSITORY:$IMAGE_TAG
47+
48+
- name: ReDeploy ECS Service
49+
env:
50+
SERVICE: "mage${{ env.IMAGE_TAG }}"
51+
run: |
52+
aws ecs update-service --cluster magedev --service $SERVICE --force-new-deployment

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ WORKDIR /imageserviceplugin
4444
COPY plugins/image/service/package*.json ./
4545
RUN npm install
4646
COPY --from=build-service /service /imageserviceplugin/node_modules/@ngageoint/mage.service
47+
RUN rm -rf /imageserviceplugin/node_modules/@ngageoint/mage.service/node_modules/mongoose
4748
COPY plugins/image/service/ ./
4849
RUN npm run build
4950
RUN npm pack

0 commit comments

Comments
 (0)