Compare commits

...

2 commits

Author SHA1 Message Date
Imbus
4de34e4adb Ignorefiles 2024-02-12 12:31:26 +01:00
Imbus
afe10b8b07 Container related files 2024-02-12 12:30:38 +01:00
3 changed files with 75 additions and 0 deletions

4
.containerignore Normal file
View file

@ -0,0 +1,4 @@
**/target
**/node_modules
**/dist
**/.sqlite3

42
.gitignore vendored Normal file
View file

@ -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

29
container/Containerfile Normal file
View file

@ -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"]