Update buildx
This commit is contained in:
parent
ed6b0193cb
commit
fa9178f83e
2 changed files with 29 additions and 0 deletions
|
@ -13,6 +13,9 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
# Set environment variable to connect to docker-in-docker service (for consistency)
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://docker-in-docker:2375
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
@ -34,9 +37,18 @@ jobs:
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
|
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
|
||||||
|
# Set environment variable to connect to docker-in-docker service
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://docker-in-docker:2375
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Verify Docker connection to docker-in-docker service
|
||||||
|
- name: Verify Docker connection
|
||||||
|
run: |
|
||||||
|
echo "Using Docker host: $DOCKER_HOST"
|
||||||
|
docker version || true
|
||||||
|
|
||||||
- name: Docker info
|
- name: Docker info
|
||||||
run: |
|
run: |
|
||||||
docker info
|
docker info
|
||||||
|
|
|
@ -155,6 +155,23 @@ This project includes a CI/CD pipeline configured in `.forgejo/workflows/build.y
|
||||||
- `latest` (for the most recent build)
|
- `latest` (for the most recent build)
|
||||||
5. The Docker image is pushed to the Forgejo Container Registry at `${FORGEJO_REGISTRY}/${FORGEJO_USERNAME}/podcastrr`.
|
5. The Docker image is pushed to the Forgejo Container Registry at `${FORGEJO_REGISTRY}/${FORGEJO_USERNAME}/podcastrr`.
|
||||||
|
|
||||||
|
### Docker-in-Docker for CI/CD
|
||||||
|
|
||||||
|
The CI/CD pipeline uses Docker-in-Docker (DinD) provided by the Forgejo runner to build and push Docker images. This approach has several advantages:
|
||||||
|
|
||||||
|
1. **Isolation**: The Docker daemon runs in its own container, providing better isolation.
|
||||||
|
2. **Security**: Reduces the attack surface by not requiring privileged access to the host.
|
||||||
|
3. **Consistency**: Ensures a consistent Docker environment for all builds.
|
||||||
|
|
||||||
|
The CI/CD workflow connects to the Docker-in-Docker service using the `DOCKER_HOST` environment variable:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://docker-in-docker:2375
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: The Docker-in-Docker service is provided by the Forgejo runner infrastructure and does not need to be configured in your docker-compose.yml file.
|
||||||
|
|
||||||
### Using the published Docker image
|
### Using the published Docker image
|
||||||
|
|
||||||
To use the published Docker image in your deployment:
|
To use the published Docker image in your deployment:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue