From afe10b8b0749563acd85ddf3ab87b406db57894a Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 12 Feb 2024 12:30:38 +0100 Subject: [PATCH 1/2] Container related files --- container/Containerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 container/Containerfile diff --git a/container/Containerfile b/container/Containerfile new file mode 100644 index 0000000..ac4f770 --- /dev/null +++ b/container/Containerfile @@ -0,0 +1,29 @@ +# Client/frontend build in an isolated stage +# We use node:latest as the base image. +# Essentially we build the frontend SPA with vite and +# make it available in the public directory. +FROM docker.io/node:latest as client +WORKDIR /build +ADD frontend /build +RUN npm install +RUN npm run build + +# Builds the server in an isolated stage +FROM docker.io/golang:latest as go +ADD backend /build +WORKDIR /build + +# Copy the frontend SPA build into public +COPY --from=client /build/dist /build/static + +# Get the dependencies +RUN go mod download + +# RUN go build -o server +RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o ./server ./cmd/ + +# Expose port 8080 +EXPOSE 8080 + +# Run the server +CMD ["./server"] \ No newline at end of file From 4de34e4adbafaeec249ecae3fede4ba4eec4c03e Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 12 Feb 2024 12:31:26 +0100 Subject: [PATCH 2/2] Ignorefiles --- .containerignore | 4 ++++ .gitignore | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .containerignore create mode 100644 .gitignore diff --git a/.containerignore b/.containerignore new file mode 100644 index 0000000..b5b7c6a --- /dev/null +++ b/.containerignore @@ -0,0 +1,4 @@ +**/target +**/node_modules +**/dist +**/.sqlite3 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd09b0b --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +bin +db.sqlite3 + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Go workspace file +go.work + +# Ignore dependency directories +node_modules +vendor/ + +# Ignore build artifacts +build/ +dist/ +*.log + +# Ignore IDE and editor-specific files +.vscode/ +.idea/ +.DS_Store + +# Ignore configuration files +.env +.env.local +*.conf + +# Ignore user-specific files +*.suo +*.user +