FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 04379afa authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

feat: add development docker compose configuration

Add a simple docker compose configuration which can be used to test the
application in local development.
parent 9280e6e5
No related branches found
No related tags found
No related merge requests found
###################################################################################################
# Image used to build frontend.
FROM node:lts AS frontend-builder FROM node:lts AS frontend-builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
...@@ -10,7 +12,9 @@ RUN yarn config set network-timeout 600000 -g && yarn install ...@@ -10,7 +12,9 @@ RUN yarn config set network-timeout 600000 -g && yarn install
COPY ./frontend/ . COPY ./frontend/ .
RUN yarn build RUN yarn build
FROM registry.gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/django:4.2-py3.11-alpine AS base ###################################################################################################
# Production image
FROM registry.gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/django:4.2-py3.11-alpine AS production
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
WORKDIR /usr/src/app WORKDIR /usr/src/app
...@@ -19,4 +23,5 @@ RUN --mount=type=bind,target=/context pip install /context ...@@ -19,4 +23,5 @@ RUN --mount=type=bind,target=/context pip install /context
COPY --from=frontend-builder /usr/src/app/build/ ./frontend/build/ COPY --from=frontend-builder /usr/src/app/build/ ./frontend/build/
ENV GATEWAY_CONSOLE_UI_DIR=/usr/src/app/frontend/build ENV GATEWAY_CONSOLE_UI_DIR=/usr/src/app/frontend/build
ENTRYPOINT ["api-gateway-emulator"] ENTRYPOINT ["api-gateway-emulator"]
...@@ -8,8 +8,15 @@ which forward requests to the URL pointed to by the ...@@ -8,8 +8,15 @@ which forward requests to the URL pointed to by the
A proxy configuration UI is at port 9001. A proxy configuration UI is at port 9001.
Initial proxy configuration can be influenced by other `GATEWAY_...` Initial proxy configuration can be influenced by other `GATEWAY_...` environment variables. See the
environment variables. [definition of the Settings class](./api_gateway_emulator/__init__.py).
## Backend development
You can start a simple development instance via `docker compose up --build`. **CHANGES ARE NOT HOT
RELOADED.** If you make a change, you will need to restart the server via `docker compose down` and
`docker compose up --build`. The proxied application is a simple echo server which returns details
of the incoming request as a JSON document.
## Frontend development ## Frontend development
......
services:
proxy:
build:
context: .
ports:
- 9000:9000
- 9001:9001
depends_on:
- echo
environment:
GATEWAY_PROXY_DESTINATION_URL: http://echo:80/
echo:
image: ealen/echo-server
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment