Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions .github/workflows/ci_fast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,33 @@ jobs:
name: website
path: ./public

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
aws-access-key-id: ${{ secrets.DELPHI_ECR_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.DELPHI_ECR_ACCESS_KEY }}
aws-region: us-east-1
registry: ghcr.io
username: cmu-delphi-deploy-machine
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
- name: Build, tag, and push image to Github
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ github.event.repository.name }}
DEVOPS_DOCKER_FILE: ./devops/precompiled.dockerfile
run: |
baseRef="${GITHUB_REF#*/}"
baseRef="${baseRef#*/}"
case "${baseRef}" in
main)
awsTag="latest"
imageTag="latest"
;;
*)
awsTag="${baseRef//\//_}" # replace `/` with `_` in branch name
imageTag="${baseRef//\//_}" # replace `/` with `_` in branch name
;;
esac
echo "using tag: --${awsTag}--"
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag --file ./devops/precompiled/Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag
echo "using tag: --${imageTag}--"
docker build -t ghcr.io/${{ github.repository }}:$imageTag --file ${DEVOPS_DOCKER_FILE} .
docker push ghcr.io/${{ github.repository }}:$imageTag

# trigger a webhook update
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "repository=$ECR_REGISTRY/$ECR_REPOSITORY&tag=$awsTag"
-d "repository=ghcr.io/${{ github.repository }}&tag=$imageTag"
1 change: 1 addition & 0 deletions devops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN npm ci --unsafe-perm
RUN npm run build

FROM nginx:stable-alpine
LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/www-main
COPY --from=builder /src/public /usr/share/nginx/html
# ensure files are readable at runtime
RUN chmod o+r -R /usr/share/nginx/html/
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# docker image using the current built website
FROM nginx:stable-alpine
LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/www-main

COPY ./public /usr/share/nginx/html
# ensure files are readable at runtime
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
r:
build:
context: .
dockerfile: devops/r/Dockerfile
dockerfile: devops/r.dockerfile
working_dir: "/app"
command: tail -F anything
volumes:
Expand Down