Behaviour
The following .dockerignore file produced different docker images when running on github actions than when it was executed on my machine:
/**
!/api
!/config
!/extensions
!/public
!/favicon.ico
!/package.json
!/yarn.lock
Steps to reproduce this issue
- clone a Strapi repo (eg https://github.com/kevinadhiguna/strapi-dockerize);
docker build -t local-test-build:1 -f Dockerfile .;
- define an github actions job using
docker/build-push-action@v2;
- compare both images produced, paying attention to the directories defined on the on the
.dockerignore file previously described.
Expected behaviour
Both images created should have the same files inside their directories, even the ones defined on the .dockerignore file
Actual behaviour
On the image built locally, directories such as /api or /config have their content copied from the repository. But it is not happening with the images from the workflow, which the directories are completely empty.
Configuration
---
name: CI
# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- api/**
- config/**
- extensions/**
- public/**
- .dockerignore
- Dockerfile
- favicon.ico
- package.json
- yarn.lock
push:
branches:
- main
paths:
- api/**
- config/**
- extensions/**
- public/**
- .dockerignore
- Dockerfile
- favicon.ico
- package.json
- yarn.lock
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get Short SHA
id: sha
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Checkout Code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.ABC }}
password: ${{ secrets.XYZ }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: ./
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/${{ github.repository }}:${{ steps.sha.outputs.sha8 }}
ghcr.io/${{ github.repository }}:latest
Behaviour
The following
.dockerignorefile produced different docker images when running on github actions than when it was executed on my machine:Steps to reproduce this issue
docker build -t local-test-build:1 -f Dockerfile .;docker/build-push-action@v2;.dockerignorefile previously described.Expected behaviour
Actual behaviour
Configuration