joint deploy of API and React APP'

This commit is contained in:
Steve White 2024-10-24 16:08:35 -05:00
commit 89c73386bd
5 changed files with 47 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "boxes-fe"]
path = boxes-fe
url = git@gitea.r8z.us:stwhite/boxes-fe.git
[submodule "boxes-api"]
path = boxes-api
url = git@gitea.r8z.us:stwhite/boxes-api.git

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# Build React frontend
# Stage 1: Install dependencies
FROM node:14 AS fe-builder
WORKDIR /app
# Copy package.json and package-lock.json first to leverage caching
COPY boxes-fe/package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of your application code
COPY boxes-fe/.env .
COPY boxes-fe/. .
# Build the application
RUN npm run build
# next stage
FROM golang:latest
WORKDIR /app
COPY boxes-api/go.mod ./
COPY boxes-api/go.sum ./
RUN go mod download
COPY boxes-api/. ./
ENV CGO_ENABLED=1
RUN go build -o boxes-api .
COPY --from=fe-builder /app/build /app/build
EXPOSE 8080
CMD ["./boxes-api"]

1
boxes-api Submodule

@ -0,0 +1 @@
Subproject commit 76a03cda573f415c7dd1de64823037dc683bf98b

1
boxes-fe Submodule

@ -0,0 +1 @@
Subproject commit 158d52dab4a633ddd972de5cc63b5f62564b4877

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3.3'
services:
boxes-api:
environment:
- BOXES_API_CONFIG=/app/config/config.yaml
build: .
ports:
- "8080:8080"
volumes:
- ./boxes-api/images:/app/images
- ./boxes-api/config:/app/config
- ./boxes-api/data:/app/data