#### Dockerfile with custom parent image

How can I use existing images as the FROM parameter in a dockerfile?

I’m trying to dockerize a VueJS application, but wanted pierrezemb/gostatic to be the base image — it’s a tiny http server that, in principle, is able to host files and directories. However, when running the completed image and checking the exposed port in the browser, the index.html file loads but all other resources in subfolders 404 fail with:
The resource from “http://localhost:8043/js/app.545bfbc1.js” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff). Curling the resource returns just the 404.

This is likely because the gostatic base image is created to be very much standalone, not to be included as the FROM parameter in a Dockerfile. When I build the code myself and use gostatic to host the directory, everything is fine. When I build with a Dockerfile, build succeeds but I get the aforementioned errors when trying to get resources not in the main directory.

Current Dockerfile

FROM pierrezemb/gostatic AS deployment

COPY ./dist/* /srv/http/
EXPOSE 8043

# Note, gostatic calls: ENTRYPOINT ["/goStatic"]
# Therefore CMD need only be goStatic parameters
CMD ["-enable-health", "-enable-logging"]


Note, dist folder is built and functioning. Also notably, the health endpoint doesn’t work, and there is no logging (which the flags are set for). It’s clear I’m handling the parent image wrong

I’m building and running with the following commands:

docker build -t tweet-dash .
docker run -d -p 8043:8043 --name dash tweet-dash


Dockerfile for goStatic is here

Source: Docker Questions