Issue with Dockerfile - Failing to Add SSL Certificates to HAProxy Container

Hello everyone,

I am working on setting up a reverse proxy using HAProxy, and I am encountering an issue while building my Docker image. The goal is to add custom SSL certificates to the HAProxy container without using Let’s Encrypt, by using locally stored SSL files.

Here’s the problem: when I try to build the Docker image, I receive the following error:

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b2ec78db-236b-47cc-9543-890734d42418::7xwfa6rqng1ouum71x85abojp: “/opt/openremote/deployment/certs2”: not found

Context:

My working directory is /opt/openremote/proxy, where I’ve placed the Dockerfile and the certs2 directory containing my SSL files.
The path in the Dockerfile: I’m trying to add the certificates directory using ADD /opt/openremote/deployment/certs2 /etc/haproxy/certs2, but Docker is unable to find the directory.

What I’ve already tried:

I copied the necessary files into /opt/openremote/proxy/certs2.
I updated the Dockerfile to reflect the correct path for the certificates, but the error persists.

My Dockerfile:

-----------------------------------------------------------------------------------------------

HAProxy image with certbot for certificate generation and renewal

-----------------------------------------------------------------------------------------------

FROM haproxy:2.9-alpine
MAINTAINER support@openremote.io

USER root

Other environment variables…

Adding certificates

ADD certs2 /etc/haproxy/certs2

Questions:

Is the issue related to Docker not finding the local path /opt/openremote/deployment/certs2?
What is the correct way to reference a local directory in a Dockerfile when adding files to a Docker image?
Should I be using a relative or absolute path for local files I want to add to the container?

Additionally, I have a VPS server hosted on IONOS, and I’d like to link my SSL certificates (other than Let’s Encrypt) to it. Does anyone have a tutorial or guide on how to set up SSL certificates on a VPS and attach them to a server (other than using Let’s Encrypt)?

Thank you in advance for your help!

Paths should be relative to your build content (see Build context | Docker Docs), so use
ADD certs2 /etc/haproxy/certs2

Thank you for your response!

Could you please clarify whether the relative path for the SSL certificates should be specified in the haproxy.cfg file or in the docker-compose.yml file?

Looking forward to your feedback, and thanks again for your help!