Prepare for deployment
This commit is contained in:
parent
5d052d46fd
commit
002b9e618b
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ui/node_modules
|
||||||
|
ui/build
|
20
.drone.yml
20
.drone.yml
@ -8,6 +8,16 @@ platform:
|
|||||||
arch: arm
|
arch: arm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: build front
|
||||||
|
image: node:17-alpine
|
||||||
|
commands:
|
||||||
|
- mkdir deploy
|
||||||
|
- apk --no-cache add python2 build-base
|
||||||
|
- cd ui
|
||||||
|
- npm install --network-timeout=100000
|
||||||
|
- npm run build
|
||||||
|
- tar chjf ../deploy/static.tar.bz2 build
|
||||||
|
|
||||||
- name: vet
|
- name: vet
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
commands:
|
commands:
|
||||||
@ -44,6 +54,16 @@ platform:
|
|||||||
arch: arm64
|
arch: arm64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: build front
|
||||||
|
image: node:17-alpine
|
||||||
|
commands:
|
||||||
|
- mkdir deploy
|
||||||
|
- apk --no-cache add python2 build-base
|
||||||
|
- cd ui
|
||||||
|
- npm install --network-timeout=100000
|
||||||
|
- npm run build
|
||||||
|
- tar chjf ../deploy/static.tar.bz2 build
|
||||||
|
|
||||||
- name: vet
|
- name: vet
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
commands:
|
commands:
|
||||||
|
24
Dockerfile
24
Dockerfile
@ -1,18 +1,30 @@
|
|||||||
FROM golang:alpine as gobuild
|
FROM node:17-alpine as nodebuild
|
||||||
|
|
||||||
|
WORKDIR /ui
|
||||||
|
|
||||||
|
RUN apk --no-cache add python2 build-base
|
||||||
|
|
||||||
|
COPY ui/ .
|
||||||
|
|
||||||
|
RUN npm install --network-timeout=100000 && \
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
|
||||||
|
FROM golang:1-alpine as gobuild
|
||||||
|
|
||||||
RUN apk add --no-cache go-bindata
|
RUN apk add --no-cache go-bindata
|
||||||
|
|
||||||
WORKDIR /go/src/git.nemunai.re/atsebay.t
|
WORKDIR /go/src/git.nemunai.re/atsebay.t
|
||||||
|
|
||||||
COPY *.go go.mod go.sum ./
|
COPY *.go go.mod go.sum ./
|
||||||
COPY htdocs/ ./htdocs/
|
COPY --from=nodebuild /ui/build ui/build
|
||||||
|
|
||||||
RUN go generate -v && \
|
RUN go get -d -v && \
|
||||||
go get -d -v && \
|
go generate -v && \
|
||||||
go build -v -ldflags="-s -w"
|
go build -v -ldflags="-s -w" -o atsebay.t
|
||||||
|
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine:3.15
|
||||||
|
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed htdocs
|
//go:embed ui/build/* ui/build/_app/* ui/build/_app/assets/pages/* ui/build/_app/pages/* ui/build/_app/pages/grades/* ui/build/_app/pages/surveys/* ui/build/_app/pages/surveys/_sid_/* ui/build/_app/pages/surveys/_sid_/responses/* ui/build/_app/pages/users/* ui/build/_app/pages/users/_uid_/* ui/build/_app/pages/users/_uid_/surveys/*
|
||||||
var _assets embed.FS
|
var _assets embed.FS
|
||||||
|
|
||||||
var Assets http.FileSystem
|
var Assets http.FileSystem
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
sub, err := fs.Sub(_assets, "htdocs")
|
sub, err := fs.Sub(_assets, "ui/build")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Unable to cd to htdocs/ directory:", err)
|
log.Fatal("Unable to cd to ui/build/ directory:", err)
|
||||||
}
|
}
|
||||||
Assets = http.FS(sub)
|
Assets = http.FS(sub)
|
||||||
}
|
}
|
||||||
|
31
ui/package-lock.json
generated
31
ui/package-lock.json
generated
@ -127,6 +127,15 @@
|
|||||||
"picomatch": "^2.2.2"
|
"picomatch": "^2.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@sveltejs/adapter-static": {
|
||||||
|
"version": "1.0.0-next.28",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-1.0.0-next.28.tgz",
|
||||||
|
"integrity": "sha512-c4xLyeSwnbGQxe4f1SLpHTbxZDm3TEr43scR3tOlVgQN+mnAL9aDdl3nTtdzWmrUDmDEmY4GriAwLyFLZuINLw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"tiny-glob": "^0.2.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@sveltejs/kit": {
|
"@sveltejs/kit": {
|
||||||
"version": "1.0.0-next.266",
|
"version": "1.0.0-next.266",
|
||||||
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.266.tgz",
|
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.266.tgz",
|
||||||
@ -1034,6 +1043,12 @@
|
|||||||
"type-fest": "^0.20.2"
|
"type-fest": "^0.20.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"globalyzer": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"globby": {
|
"globby": {
|
||||||
"version": "11.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
|
||||||
@ -1048,6 +1063,12 @@
|
|||||||
"slash": "^3.0.0"
|
"slash": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"globrex": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "4.2.9",
|
"version": "4.2.9",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
|
||||||
@ -1768,6 +1789,16 @@
|
|||||||
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
|
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"tiny-glob": {
|
||||||
|
"version": "0.2.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
|
||||||
|
"integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"globalyzer": "0.1.0",
|
||||||
|
"globrex": "^0.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"to-regex-range": {
|
"to-regex-range": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@sveltejs/adapter-static": "^1.0.0-next.28",
|
||||||
"@sveltejs/kit": "^1.0.0-next.266",
|
"@sveltejs/kit": "^1.0.0-next.266",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||||
"@typescript-eslint/parser": "^4.33.0",
|
"@typescript-eslint/parser": "^4.33.0",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import adapter from '@sveltejs/adapter-static';
|
||||||
import preprocess from 'svelte-preprocess';
|
import preprocess from 'svelte-preprocess';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
@ -7,6 +8,9 @@ const config = {
|
|||||||
preprocess: preprocess(),
|
preprocess: preprocess(),
|
||||||
|
|
||||||
kit: {
|
kit: {
|
||||||
|
adapter: adapter({
|
||||||
|
fallback: 'index.html'
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user