Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker-publish.yml #22

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
6b478b5
Update docker-publish.yml
curtishall Jul 29, 2023
afec333
Update docker-publish.yml
curtishall Jul 29, 2023
26f7597
Update docker-publish.yml
curtishall Jul 29, 2023
e9ea404
Update docker-publish.yml
curtishall Jul 29, 2023
ca2368e
Update docker-publish.yml
curtishall Jul 29, 2023
a096b06
Update docker-publish.yml
curtishall Jul 29, 2023
d3645df
Update docker-publish.yml
curtishall Jul 29, 2023
0eed772
Update docker-publish.yml
curtishall Jul 29, 2023
8a73d41
Update docker-publish.yml
curtishall Jul 29, 2023
a58d79b
Update docker-publish.yml
curtishall Jul 29, 2023
13231d6
Update docker-publish.yml
curtishall Jul 29, 2023
60e3abe
Update docker-publish.yml
curtishall Jul 29, 2023
eef4531
Update Dockerfile
curtishall Jul 29, 2023
f9bc08b
Update docker-publish.yml
curtishall Jul 29, 2023
6722a8b
Update Dockerfile
curtishall Jul 29, 2023
d56066d
Update Dockerfile
curtishall Jul 29, 2023
1358d8c
Update Dockerfile
curtishall Jul 31, 2023
20e6e5a
Update Dockerfile
curtishall Jul 31, 2023
b7bbb5a
Update Dockerfile
curtishall Jul 31, 2023
7f9b85f
Update Dockerfile
curtishall Aug 1, 2023
54a6c13
Update Dockerfile
curtishall Aug 1, 2023
51b9de8
Update Dockerfile
curtishall Aug 1, 2023
38ade2e
Update Dockerfile
curtishall Aug 1, 2023
a412f52
Update docker-publish.yml
curtishall Aug 1, 2023
f67f6ff
Update docker-publish.yml
curtishall Aug 1, 2023
f73727e
Update docker-publish.yml
curtishall Aug 1, 2023
b2e3b00
Update docker-publish.yml
curtishall Aug 1, 2023
123e424
Update docker-publish.yml
curtishall Aug 1, 2023
bf63a2b
Update docker-publish.yml
curtishall Aug 1, 2023
46b198f
Update docker-publish.yml
curtishall Aug 1, 2023
4c73dbf
Update docker-publish.yml
curtishall Aug 1, 2023
fc08a36
Update docker-publish.yml
curtishall Aug 1, 2023
6403e61
Update Dockerfile
curtishall Aug 1, 2023
228da46
Update Dockerfile
curtishall Aug 1, 2023
036c51c
Update Dockerfile
curtishall Aug 1, 2023
dd68a5c
Update docker-publish.yml
curtishall Aug 1, 2023
1f011a4
Update Dockerfile
curtishall Aug 1, 2023
8d888ab
Update docker-publish.yml
curtishall Aug 1, 2023
95ae1a4
Update Dockerfile
curtishall Aug 1, 2023
11452ea
Update docker-publish.yml
curtishall Aug 1, 2023
fa8d9e3
Update docker-publish.yml
curtishall Aug 1, 2023
5ba9ef6
Update docker-publish.yml
curtishall Aug 1, 2023
3ec53b2
Update Dockerfile
curtishall Aug 1, 2023
9c0db16
Update docker-publish.yml
curtishall Aug 1, 2023
a657eea
Update docker-publish.yml
curtishall Aug 1, 2023
7aa4cbe
Update docker-publish.yml
curtishall Aug 1, 2023
3116123
Update docker-publish.yml
curtishall Aug 1, 2023
991eaf7
Update docker-publish.yml
curtishall Aug 2, 2023
d9abdf1
Update docker-publish.yml
curtishall Aug 2, 2023
6fbf15b
Update docker-publish.yml
curtishall Aug 2, 2023
093238a
Update docker-publish.yml
curtishall Aug 2, 2023
1daa658
Update docker-publish.yml
curtishall Aug 2, 2023
979b056
Update docker-publish.yml
curtishall Aug 2, 2023
b3c2b8f
Update docker-publish.yml
curtishall Aug 2, 2023
c0cfc1a
Update docker-publish.yml
curtishall Aug 2, 2023
5ce4300
Create Dockerfile
curtishall Aug 2, 2023
cfe772a
Update docker-publish.yml
curtishall Aug 2, 2023
bd6f012
Update Dockerfile
curtishall Aug 2, 2023
914697b
Update docker-publish.yml
curtishall Aug 2, 2023
9b8bcf8
Update Dockerfile
curtishall Aug 2, 2023
8045fc2
Update Dockerfile
curtishall Aug 2, 2023
2402207
Update Dockerfile
curtishall Aug 2, 2023
1a17304
Update Dockerfile
curtishall Aug 2, 2023
844da94
Update Dockerfile
curtishall Aug 2, 2023
df24431
Update docker-publish.yml
curtishall Aug 2, 2023
511fa88
Update docker-publish.yml
curtishall Aug 2, 2023
8a19ab0
Update docker-publish.yml
curtishall Aug 2, 2023
b4b89cc
Update docker-publish.yml
curtishall Aug 2, 2023
b74c36c
Update docker-compose.yml
curtishall Aug 3, 2023
dfe1082
Update Dockerfile
curtishall Aug 3, 2023
40fcc3c
Update entrypoint.sh
curtishall Aug 3, 2023
d1f235d
Add files via upload
curtishall Aug 3, 2023
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
152 changes: 65 additions & 87 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Docker

name: Publish Docker image
on:
push:
# TODO: Add push type for release
# Publish `master` as Docker `latest` image.
branches:
- master
- mysql

# Publish `v1.2.3` tags as releases.
tags:
Expand All @@ -13,91 +14,68 @@ on:
# Run tests for any PRs.
pull_request:

env:
# TODO: Change variable to your image's name.
IMAGE_NAME: image

jobs:
# Run tests.
# steps:
# - uses: actions/checkout@v2
# Setup mysqlserver.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-20.04

services:
mysql:
image: mysql:8.0.23
env:
MYSQL_USER: test
MYSQL_ROOT_PASSWORD: test
ports:
- 3306

steps:
- uses: actions/checkout@v2

- name: Get the mysql host
id: get_host
run: |
#host=`docker network inspect -f '{{(index .IPAM.Config 0).Gateway}}' bridge`
#echo "db-host=$host" >> $GITHUB_OUTPUT
#echo "$db-host"
sudo apt -y install mysql-client
mysql -uroot --password=test -h ${{ steps.get_host.outputs.db-host }} --port ${{ job.services.mysql.ports['3306'] }} -e 'show databases;'

- name: Copy envs
run: |
cp -a .env-org server/.env
sed -i 's/127.0.0.1/${{ steps.get_host.outputs.db-host }}/g' server/.env
cat server/.env



- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file server/Dockerfile --build-arg="$db-host"
fi

# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

jobs:
mysql57:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: docker build . --file server/Dockerfile --tag $IMAGE_NAME

- name: Log into GitHub Container Registry
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image to GitHub Container Registry
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
- uses: actions/checkout@v2
- name: Shutdown existing MySQL
run: sudo service mysql stop


push_to_registries:
#- name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set up MySQL
uses: cweinberger/github-actions-mysql@main
with:
version: 5.7
hostPort: 3306
containerPort: 3306
rootPassword: root
user: TestUser
password: TestPassword
database: TestDatabase
characterSet: utf8mb4
collation: utf8mb4_general_ci
sqlMode: NO_ENGINE_SUBSTITUTION

- name: Print running docker containers
run: docker ps
- name: Check out the repo
uses: actions/checkout@v3
- name: Wait for mysql
run: sleep 15
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# username: curtishall
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
# with:
# images: bluecherrydvr/bluecherry
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
#working-directory: server/
context: "{{defaultContext}}:server"
# username: curtishall
# password: ${{ secrets.DOCKER_PASSWORD }}
# file: ./server/Dockerfile
push: true
tags: bluecherrydvr/bluecherry:citesting
labels: github_ci
Loading