Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Containerise (or containerize) #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ExZyle
Copy link

@ExZyle ExZyle commented Jan 8, 2024

Summary

This pull request includes changes for a production container build that can be used by docker or podman.

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 also
includes .git/, .vscode/ and anything else that may be floating around the directory.

Changes

Here are the main changes made in this PR:

  • Add a .dockerignore to ensure unused directories are not copied into images
  • Add a Dockerfile.prod to build a production container

Container 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:

docker build -t chatgpt -f Dockerfile.prod .

If you are using podman simply replace docker with podman

Running the Container

There are multiple ways to run a container. For a clean quickstart method, use:

docker run --rm chatgpt

If you are using podman simply replace docker with podman

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:

docker pull exzyle/chatgpt:20240108000
docker run --rm exzyle/chatgpt:20240108000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant