Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Add basic Dockerfile to build and serve the app #268

Merged
merged 2 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:14-buster-slim AS builder

# Install all OS dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update --yes && \
apt-get upgrade --yes && \
apt-get install --yes --no-install-recommends \
build-essential

# Copy over required files for build
WORKDIR /var/app
COPY config /var/app/config
COPY fixtures /var/app/fixtures
COPY public /var/app/public
COPY src /var/app/src
COPY .babelrc .env .eslintignore .eslintrc package-lock.json package.json /var/app/

# Build the app
RUN npm install
RUN npm run build

# Serve the production build files via nginx (will be served at http://localhost:80/caravan)
FROM nginx:1.23
COPY --from=builder /var/app/build /usr/share/nginx/html/caravan
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ $ npm run build
...
```

### Docker

A basic dockerfile which builds the app and serves it via nginx is included in the repository

To build the docker image:
```bash
docker build . -t caravan:latest
```

To run the built docker image:
```bash
docker run -p 80:8000 caravan:latest
```

Caravan should then be accessible at http://localhost:8000/caravan

## Usage

If you can access the [Caravan web
Expand Down