Skip to content

Commit

Permalink
test container pulling and running
Browse files Browse the repository at this point in the history
  • Loading branch information
linozen committed Jul 19, 2021
1 parent 32fb4ef commit f8e4fa5
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2

- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
# - name: Deploy Docker image to server using SSH
# uses: appleboy/ssh-action@master
# with:
# host: ioi.sehn.dev
# username: root
# key: ${{ secrets.KEY }}
# script: |
# docker pull docker.pkg.github.com/snv-berlin/ioi/survey-explorer:latest
# docker stop survey-explorer
# docker rm survey-explorer
# docker run -d -p 8501:8501 --name survey-explorer docker.pkg.github.com/snv-berlin/ioi/survey-explorer:latest
# - name: Build image
# run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

# - name: Log in to registry
# # This is where you will update the PAT to GITHUB_TOKEN
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

# - name: Push image
# run: |
# IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME

# # Change all uppercase to lowercase
# IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# # Strip git ref prefix from version
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# # Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# # Use Docker `latest` tag convention
# [ "$VERSION" == "master" ] && VERSION=latest
# echo IMAGE_ID=$IMAGE_ID
# echo VERSION=$VERSION
# docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
# docker push $IMAGE_ID:$VERSION

- name: Deploy Docker image to server using SSH
uses: appleboy/ssh-action@master
with:
host: ioi.sehn.dev
username: root
key: ${{ secrets.KEY }}
script: |
docker pull gchr.io/snv-berlin/$IMAGE_NAME:latest
docker run $IMAGE_NAME:latest streamlit run --server.port 8501 explorer/all.py
docker run $IMAGE_NAME:latest streamlit run --server.port 8502 explorer/media.py
docker run $IMAGE_NAME:latest streamlit run --server.port 8503 explorer/civsoc.py

0 comments on commit f8e4fa5

Please sign in to comment.