Docker build contexts
See original GitHub issueI’m not sure what the right answer to this problem is, but here’s the situation I am in. We have a Dockerized PHP application. We deploy it as pods with two containers: one running php-fpm, the other running nginx with a fastcgi_proxy. As far as I know, this is the best way to put a PHP application into Kubernetes.
An example directory structure:
myrepo.git
├── containers
│ └── proxy
│ ├── Dockerfile
│ └── nginx.conf
├── public
├── src
│ └── ...
└── Dockerfile
And the nginx proxy’s Dockerfile:
# ./containers/proxy/Dockerfile
FROM nginx:1.13-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /srv/public
COPY ../../public /srv/public
WORKDIR /srv
The problem is that, currently, I have to build that Dockerfile with its context as the repository root (in order to copy in the ./public
folder). Forge defaults the build context as ./containers/proxy
, where I need it to be ./
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
docker build - Docker Documentation
The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in...
Read more >Understanding the Docker Build Context (Why You Should ...
The Docker build context refers to the files and directories that will be available to the Docker engine when you run docker build...
Read more >Reduce Build Context for Docker Build Command - Baeldung
The Docker build context consists of files or folders located at the particular path or URL. During the build, those files are sent...
Read more >3 Different Ways to Provide Docker Build Context - CloudBees
When talking about Docker builds, context means the source directory used when building the container. To explain this a bit better, let's look ......
Read more >Dockerfiles : building Docker images automatically II (FROM ...
The build context will be sent to the Docker daemon before building the image, which means if you use / as the source...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, this feature should be available now as of 0.2.16. You can check out the docs here: https://forge.sh/reference/service-descriptor
I think ignoring makes sense, just needs to be documented. Gives new users the magic experience but lets you override it if/when necessary