Search code examples
dockercodeigniterdocker-compose

Docker manage to copy data but it doesn't exist


So I try bitnami codeigniter image in docker. My project look like this:

my-source-code
   |Dockerfile
   |hello-world.php
   |Home.php
docker-compose.yml

My docker-compose.yml,look like this:

# Copyright VMware, Inc.
# SPDX-License-Identifier: APACHE-2.0

version: '2'

services:
  mariadb:
    image: docker.io/bitnami/mariadb:10.6
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_myapp
      - MARIADB_DATABASE=bitnami_myapp
    volumes:
      - './my-database:/bitnami/mariadb'
  my-docker-app:
    build: ./my-souce-code
    ports:
      - '8000:8000'
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - CODEIGNITER_DATABASE_HOST=mariadb
      - CODEIGNITER_DATABASE_PORT_NUMBER=3306
      - CODEIGNITER_DATABASE_USER=bn_myapp
      - CODEIGNITER_DATABASE_NAME=bitnami_myapp
    volumes:
      - './my-docker-project:/app'
    depends_on:
      - mariadb

It suppose to build codeigniter image and then change the default Welcome Screen to Hello World. My Dockerfile in my-source-code look like this:

FROM bitnami/codeigniter:4

COPY hello_world.php ./my-docker-app/app/Views/hello_world.php
COPY Home.php ./my-docker-app/app/Controllers/Home.php 

When I run docker compose up, seems like it execute this Dockerfile, and I see a notice that said that it has COPY both file. The location should be mount in local, so I try to check on that location, but find nothing. Seems like it COPY it first then build the codeigniter. Can someone explain on how to execute the copy after the codeigniter has build


Solution

  • Actually I do pretty bad in this question. I can just put the folder with everything on it and build the docker with the mounted folder instead of trying to copy it.