Dockerfiles
This commit is contained in:
parent
bf6873d261
commit
454fe9b4bc
|
@ -0,0 +1,4 @@
|
||||||
|
*.sqlite
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yaml
|
||||||
|
.dockerignore
|
|
@ -0,0 +1,20 @@
|
||||||
|
FROM golang:1.21.5 as backend-builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=1 GOOS=linux go build -o main .
|
||||||
|
|
||||||
|
# FROM alpine:latest
|
||||||
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
VOLUME /data
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=backend-builder /app/main .
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
ENV DB_PATH=/data/db.sqlite
|
||||||
|
|
||||||
|
CMD ["./main"]
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
|
@ -14,8 +15,13 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
driver := "sqlite3"
|
driver := "sqlite3"
|
||||||
connStr := "db.sqlite"
|
|
||||||
port := "3000"
|
port := "3000"
|
||||||
|
connStr := os.Getenv("DB_PATH")
|
||||||
|
|
||||||
|
if connStr == "" {
|
||||||
|
connStr = "db.sqlite"
|
||||||
|
}
|
||||||
|
|
||||||
origins := "*"
|
origins := "*"
|
||||||
|
|
||||||
if err := db.InitDB(driver, connStr); err != nil {
|
if err := db.InitDB(driver, connStr); err != nil {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
node_modules
|
||||||
|
.eslint*
|
||||||
|
.prettier*
|
||||||
|
.git*
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yaml
|
||||||
|
public
|
||||||
|
.svelte-kot
|
||||||
|
build
|
||||||
|
.dockerignore
|
|
@ -0,0 +1,17 @@
|
||||||
|
FROM node:20 as frontend-builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
# COPY --from=frontend-builder /app/public /usr/share/nginx/html
|
||||||
|
COPY --from=frontend-builder /app .
|
||||||
|
|
||||||
|
EXPOSE 4173
|
||||||
|
|
||||||
|
CMD ["npm", "run", "preview", "--", "--port", "4173", "--host", "0.0.0.0"]
|
|
@ -15,6 +15,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.28.1",
|
"@playwright/test": "^1.28.1",
|
||||||
"@sveltejs/adapter-auto": "^3.0.0",
|
"@sveltejs/adapter-auto": "^3.0.0",
|
||||||
|
"@sveltejs/adapter-static": "^3.0.1",
|
||||||
"@sveltejs/kit": "^2.0.0",
|
"@sveltejs/kit": "^2.0.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||||
"@types/eslint": "8.56.0",
|
"@types/eslint": "8.56.0",
|
||||||
|
@ -835,6 +836,15 @@
|
||||||
"@sveltejs/kit": "^2.0.0"
|
"@sveltejs/kit": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@sveltejs/adapter-static": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-6lMvf7xYEJ+oGeR5L8DFJJrowkefTK6ZgA4JiMqoClMkKq0s6yvsd3FZfCFvX1fQ0tpCD7fkuRVHsnUVgsHyNg==",
|
||||||
|
"dev": true,
|
||||||
|
"peerDependencies": {
|
||||||
|
"@sveltejs/kit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sveltejs/kit": {
|
"node_modules/@sveltejs/kit": {
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.0.6.tgz",
|
||||||
|
|
Loading…
Reference in New Issue