Skip to content

Commit 8900c33

Browse files
authored
Merge pull request #227 from cmu-delphi/sgratzl/docker2
push to Github container registry
2 parents 801a067 + 0169dee commit 8900c33

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

.github/workflows/ci_fast.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,33 @@ jobs:
3636
name: website
3737
path: ./public
3838

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

46-
- name: Login to Amazon ECR
47-
id: login-ecr
48-
uses: aws-actions/amazon-ecr-login@v1
49-
50-
- name: Build, tag, and push image to Amazon ECR
46+
- name: Build, tag, and push image to Github
5147
env:
52-
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
53-
ECR_REPOSITORY: ${{ github.event.repository.name }}
48+
DEVOPS_DOCKER_FILE: ./devops/precompiled.dockerfile
5449
run: |
5550
baseRef="${GITHUB_REF#*/}"
5651
baseRef="${baseRef#*/}"
5752
case "${baseRef}" in
5853
main)
59-
awsTag="latest"
54+
imageTag="latest"
6055
;;
6156
*)
62-
awsTag="${baseRef//\//_}" # replace `/` with `_` in branch name
57+
imageTag="${baseRef//\//_}" # replace `/` with `_` in branch name
6358
;;
6459
esac
65-
echo "using tag: --${awsTag}--"
66-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag --file ./devops/precompiled/Dockerfile .
67-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag
60+
echo "using tag: --${imageTag}--"
61+
docker build -t ghcr.io/${{ github.repository }}:$imageTag --file ${DEVOPS_DOCKER_FILE} .
62+
docker push ghcr.io/${{ github.repository }}:$imageTag
6863
6964
# trigger a webhook update
7065
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
7166
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
7267
-H "Content-Type: application/x-www-form-urlencoded" \
73-
-d "repository=$ECR_REGISTRY/$ECR_REPOSITORY&tag=$awsTag"
68+
-d "repository=ghcr.io/${{ github.repository }}&tag=$imageTag"

devops/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ RUN npm ci --unsafe-perm
66
RUN npm run build
77

88
FROM nginx:stable-alpine
9+
LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/www-main
910
COPY --from=builder /src/public /usr/share/nginx/html
1011
# ensure files are readable at runtime
1112
RUN chmod o+r -R /usr/share/nginx/html/

devops/precompiled/Dockerfile renamed to devops/precompiled.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# docker image using the current built website
22
FROM nginx:stable-alpine
3+
LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/www-main
34

45
COPY ./public /usr/share/nginx/html
56
# ensure files are readable at runtime
File renamed without changes.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
r:
66
build:
77
context: .
8-
dockerfile: devops/r/Dockerfile
8+
dockerfile: devops/r.dockerfile
99
working_dir: "/app"
1010
command: tail -F anything
1111
volumes:

0 commit comments

Comments
 (0)