commit 89c73386bd41fddc449e25284d24bb265a436b5a Author: stwhite Date: Thu Oct 24 16:08:35 2024 -0500 joint deploy of API and React APP' diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0ac057e --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5802bfe --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/boxes-api b/boxes-api new file mode 160000 index 0000000..76a03cd --- /dev/null +++ b/boxes-api @@ -0,0 +1 @@ +Subproject commit 76a03cda573f415c7dd1de64823037dc683bf98b diff --git a/boxes-fe b/boxes-fe new file mode 160000 index 0000000..158d52d --- /dev/null +++ b/boxes-fe @@ -0,0 +1 @@ +Subproject commit 158d52dab4a633ddd972de5cc63b5f62564b4877 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..38fe41f --- /dev/null +++ b/docker-compose.yml @@ -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 +