Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request includes changes for a production container build that can be used by
docker
orpodman
.Prior Work
An outstanding PR from March/April 2023 (#7) includes a
Dockerfile
for a development build.This PR does not conflict with the previous work.
The image for PR #7 is around 245M, this one is about 13.6M (5.6M compressed)
The
.dockeringnore
file included with this PR may reduce the size of the image built by PR #7 since that image alsoincludes
.git/
,.vscode/
and anything else that may be floating around the directory.Changes
Here are the main changes made in this PR:
.dockerignore
to ensure unused directories are not copied into imagesDockerfile.prod
to build a production containerContainer Details
The build works by utilising a multi-stage build. The first stage is used to build the front-end code using a node container,
and the second layer is an nginx container that serves the compiled front-end code. There are no node artifacts left in the
final build container. The container exposes the nginx port 80 binding.
Building the Container
To build the container, use:
If you are using
podman
simply replacedocker
withpodman
Running the Container
There are multiple ways to run a container. For a clean quickstart method, use:
If you are using
podman
simply replacedocker
withpodman
You can use
CTRL-C
to quit, the--rm
option will remove the container once it stops running.Additional Information
An image I've already built for myself is available at https://hub.docker.com/r/exzyle/chatgpt/tags.
You can use it by: