Hi there,
I wanted to copy some files into docker-entrypoint-initdb.d
within Dockerfile.
Folder structure:
- dbcontainer
- Dockerfile
- init.sql
- src
- main
- resources
- dbmigration
- schema.sql
Dockerfile
FROM xxxxx/base-images/postgres:latest
COPY /init.sql /docker-entrypoint-initdb.d/
COPY /src/main/resources/dbmigration/*.sql /docker-entrypoint-initdb.d/
Codefresh step
name: db_docker_build_image
stage: test
type: build
tag: 'xxxx'
registry: my-docker-gcp-artifactory
title: Building Docker image for testing with DB container
working_directory: 'myProject/dbcontainer'
image_name: 'my_image/my_project'
dockerfile: Dockerfile
However I get melow mentioned error in the second copy line
error:
Step 6/12 : COPY /src/main/resources/dbmigration/*.sql /docker-entrypoint-initdb.d/
[2023-10-28T08:48:26.780Z] COPY failed: no source files were specified
I hope by deafult command runs from the project root folder
tried with dot as well, no luck though
COPY ./src/main/resources/dbmigration/*.sql /docker-entrypoint-initdb.d/
I know having all necessacry files in the same folder where Dockerfile is in will work here.
Just wondering whether there is any option in codefresh above step to do this?
Local machine below setup works
FROM xxxxx/base-images/postgres:latest
COPY /dbcontainer/init.sql /docker-entrypoint-initdb.d/
COPY /src/main/resources/dbmigration/*.sql /docker-entrypoint-initdb.d/
Run below from project root folder
docker build . -t my_db:v1.0 -f dbcontainer/Dockerfile