Skip to content

Commit

Permalink
CI/CD: Login To Container Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
asim3 committed Feb 17, 2024
1 parent d41ca3f commit 0c65822
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
${PROJECT_IMAGE_NAME}:${GIT_REF} 'python3 manage.py test'
# - name: Clean Up /var/lib/docker/overlay
# if: always()
# run: docker system prune --all --force --volumes


Expand All @@ -52,19 +53,29 @@ jobs:
run: >
if [ -d ./${PROJECT_NAME} ]; then
GIT_REF=$(git rev-parse --verify HEAD);
docker image build --no-cache
-t ${PROJECT_IMAGE_NAME}:${GIT_REF}
.;
docker image build --no-cache -t ${PROJECT_IMAGE_NAME}:${GIT_REF} . ;
fi;
- name: Login To Container Registry
env:
GHCR_TOKEN: "${{ secrets.CONTAINER_REGISTRY_TOKEN }}"
run: >
if [ -d ./${PROJECT_NAME} ]; then
echo ${GHCR_TOKEN} | docker login ghcr.io --username asim3 --password-stdin;
fi;
- name: Push Image To Container Registry
run: >
ls -al;
docker image ls -a;
if [ -d ./${PROJECT_NAME} ]; then
GIT_REF=$(git rev-parse --verify HEAD);
docker push ${PROJECT_IMAGE_NAME}:${GIT_REF};
fi;
- name: Clean Up Docker Login
if: always()
run: rm -rf ~/.docker

# - name: Clean Up /var/lib/docker/overlay
# if: always()
# run: docker system prune --all --force --volumes
3 changes: 3 additions & 0 deletions setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ COPY ./requirements.txt /requirements.txt

RUN pip wheel --wheel-dir=/root/wheels -r /requirements.txt

LABEL org.opencontainers.image.source=https://github.com/asim3/my_project_name
LABEL org.opencontainers.image.description="Django: my_project_name"



FROM base
Expand Down

0 comments on commit 0c65822

Please sign in to comment.