Skip to content

Commit

Permalink
chore(ci): add push images to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Apr 29, 2024
1 parent ab39ec0 commit 77e1d95
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .castor/docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function push(): void
'type' => $type,
'context' => $config['build']['context'],
'dockerfile' => $config['build']['dockerfile'] ?? 'Dockerfile',
'target' => $config['build']['target'] ?? null
'target' => $config['build']['target'] ?? null,
];
}
}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Push docker image to registry

"on":
push:
branches: ["main", "feat/registry-docker"]

permissions:
contents: read
packages: write

env:
# Fix for symfony/color detection. We know GitHub Actions can handle it
DS_REGISTRY: "ghcr.io/jolicode/docker-starter-cache"
DS_PHP_VERSION: "8.3"

jobs:
push-images:
name: Push image to registry
runs-on: ubuntu-latest
env:
DS_PHP_VERSION: "8.3"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: castor

- name: Log in to registry
shell: bash
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: "Build and start the infrastructure"
run: "castor docker:push"
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ name: Continuous Integration

permissions:
contents: read
packages: read

env:
# Fix for symfony/color detection. We know GitHub Actions can handle it
ANSICON: 1
CASTOR_CONTEXT: ci
DS_REGISTRY: "ghcr.io/jolicode/docker-starter-cache"

jobs:
check-dockerfiles:
Expand Down Expand Up @@ -42,6 +44,13 @@ jobs:
- uses: actions/checkout@v4

# Setup
- name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v3
with:
set-host: true

- name: Set Docker Socket Host
run: echo "DOCKER_SOCKET_PATH=${DOCKER_HOST:5}" >> $GITHUB_ENV

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
router:
build: services/router
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock"
- "./services/router/certs:/etc/ssl/certs"
network_mode: host
profiles:
Expand Down

0 comments on commit 77e1d95

Please sign in to comment.