ci: 👷 add dockerfile and drone build pipeline
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
RaviAnand Mohabir 2025-03-25 18:14:37 +01:00
parent 9167755c52
commit 537b060968
3 changed files with 65 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
src/wasm_exec.js
public/main.wasm

21
.drone.yml Normal file
View File

@ -0,0 +1,21 @@
kind: pipeline
type: kubernetes
name: publish Docker image on main
steps:
- image: plugins/docker
name: publish Docker image
settings:
auto_tag: true
cache_from:
- gitea.dikurium.ch/Freund_und_Partner/customer-files-organizer-web:latest
registry: gitea.dikurium.ch
repo: gitea.dikurium.ch/Freund_und_Partner/customer-files-organizer-web
username:
from_secret: git_user
password:
from_secret: git_pass
trigger:
branch:
- main
event:
- push

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM golang:1.24-alpine AS wasm_builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
RUN GOOS="js" GOARCH="wasm" go build -o main.wasm
RUN cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=wasm_builder /app/main.wasm ./public/main.wasm
COPY --from=wasm_builder /app/wasm_exec.js ./src/wasm_exec.js
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:22-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
RUN npm i -g serve
EXPOSE 3000
CMD [ "serve", "-s", "dist" ]