mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
build (migration): upgrade the build mechanism
This commit is contained in:
parent
04c97e34fb
commit
9a25fa5452
8 changed files with 81 additions and 21 deletions
12
Makefile
Normal file
12
Makefile
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
docker_dev:
|
||||||
|
@docker rm -f nuage_dev || true 2> /dev/null
|
||||||
|
@docker run -ti --net=host -v /home/mickael/Documents/projects/go/src/github.com/mickael-kerjean/nuage:/tmp/go/src/github.com/mickael-kerjean/nuage nuage_dev sh
|
||||||
|
|
||||||
|
docker_prd:
|
||||||
|
docker build -t machines/nuage docker/prod/
|
||||||
|
|
||||||
|
build_frontend:
|
||||||
|
NODE_ENV=production npm run build
|
||||||
|
|
||||||
|
build_backend:
|
||||||
|
CGO_CFLAGS_ALLOW='-fopenmp' go build -o dist/nuage server/main.go
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"general": {
|
"general": {
|
||||||
"port": 8334,
|
"port": 8334,
|
||||||
"host": "http://127.0.0.1:8334",
|
"host": "https://nuage.kerjean.me",
|
||||||
"secret_key": "example key 1234",
|
"secret_key": "",
|
||||||
"editor": "emacs",
|
"editor": "emacs",
|
||||||
"fork_button": true,
|
"fork_button": true,
|
||||||
"display_hidden": false,
|
"display_hidden": false,
|
||||||
|
|
|
||||||
51
docker/dev/Dockerfile
Normal file
51
docker/dev/Dockerfile
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
MAINTAINER mickael.kerjean@gmail.com
|
||||||
|
|
||||||
|
RUN mkdir -p /tmp/go/src/github.com/mickael-kerjean/ && \
|
||||||
|
#################
|
||||||
|
# Dependencies
|
||||||
|
apk --no-cache --virtual .build-deps add make gcc g++ curl nodejs git go && \
|
||||||
|
mkdir /tmp/deps && \
|
||||||
|
# libvips #######
|
||||||
|
cd /tmp/deps && \
|
||||||
|
curl -L -X GET https://github.com/jcupitt/libvips/releases/download/v8.6.5/vips-8.6.5.tar.gz > libvips.tar.gz && \
|
||||||
|
tar -zxf libvips.tar.gz && \
|
||||||
|
cd vips-8.6.5/ && \
|
||||||
|
apk --no-cache add libexif-dev tiff-dev jpeg-dev libjpeg-turbo-dev libpng-dev librsvg-dev giflib-dev glib-dev fftw-dev glib-dev libc-dev expat-dev orc-dev && \
|
||||||
|
./configure && \
|
||||||
|
make -j 6 && \
|
||||||
|
make install && \
|
||||||
|
# libraw ########
|
||||||
|
cd /tmp/deps && \
|
||||||
|
curl -X GET https://www.libraw.org/data/LibRaw-0.19.0.tar.gz > libraw.tar.gz && \
|
||||||
|
tar -zxf libraw.tar.gz && \
|
||||||
|
cd LibRaw-0.19.0/ && \
|
||||||
|
./configure && \
|
||||||
|
make -j 6 && \
|
||||||
|
make install && \
|
||||||
|
#################
|
||||||
|
# Prepare Build
|
||||||
|
cd /tmp/go/src/github.com/mickael-kerjean && \
|
||||||
|
apk add --no-cache --virtual .build-deps git go nodejs && \
|
||||||
|
git clone --depth 1 https://github.com/mickael-kerjean/nuage && \
|
||||||
|
cd nuage && \
|
||||||
|
mkdir -p ./dist/data/ && \
|
||||||
|
cp -R config ./dist/data/ && \
|
||||||
|
#################
|
||||||
|
# Compile Frontend
|
||||||
|
npm install && \
|
||||||
|
npm rebuild node-sass && \
|
||||||
|
NODE_ENV=production npm run build && \
|
||||||
|
#################
|
||||||
|
# Compile Backend
|
||||||
|
cd /tmp/go/src/github.com/mickael-kerjean/nuage/server && \
|
||||||
|
CGO_CFLAGS_ALLOW='-fopenmp' GOPATH=/tmp/go go get && \
|
||||||
|
cd ../ && \
|
||||||
|
GOPATH=/tmp/go go build -o ./dist/nuage ./server/main.go && \
|
||||||
|
#################
|
||||||
|
# Finalise the build
|
||||||
|
apk --no-cache add ca-certificates vim
|
||||||
|
|
||||||
|
EXPOSE 8334
|
||||||
|
WORKDIR "/tmp/go/src/github.com/mickael-kerjean/nuage"
|
||||||
|
ENV GOPATH /tmp/go
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
version: '2'
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
container_name: nuage
|
|
||||||
image: machines/nuage
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- SECRET_KEY=my_secret_key
|
|
||||||
- TRANSCODER_URL=http://transcode:8335
|
|
||||||
ports:
|
|
||||||
- "8334:8334"
|
|
||||||
|
|
||||||
transcode:
|
|
||||||
container_name: nuage_transcode
|
|
||||||
image: machines/nuage_transcode
|
|
||||||
restart: always
|
|
||||||
13
docker/prod/docker-compose.yml
Normal file
13
docker/prod/docker-compose.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: nuage
|
||||||
|
image: machines/nuage
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- APPLICATION_URL=<app_url>
|
||||||
|
- GDRIVE_CLIENT_ID=<gdrive_client>
|
||||||
|
- GDRIVE_CLIENT_SECRET=<gdrive_secret>
|
||||||
|
- DROPBOX_CLIENT_ID=<dropbox_key>
|
||||||
|
ports:
|
||||||
|
- "8334:8334"
|
||||||
|
|
@ -68,7 +68,7 @@ type Config struct {
|
||||||
ConfigPath string
|
ConfigPath string
|
||||||
FirstSetup bool
|
FirstSetup bool
|
||||||
} `-`
|
} `-`
|
||||||
MimeTypes map[string]string `json:"mimetypes"`
|
MimeTypes map[string]string `json:"mimetypes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) Initialise() {
|
func (c *Config) Initialise() {
|
||||||
|
|
@ -133,7 +133,7 @@ func (c *Config) populateDefault(path string) {
|
||||||
}
|
}
|
||||||
if c.General.SecretKey == "" {
|
if c.General.SecretKey == "" {
|
||||||
c.General.SecretKey = RandomString(16)
|
c.General.SecretKey = RandomString(16)
|
||||||
j, err := json.Marshal(c)
|
j, err := json.MarshalIndent(c, "", " ")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
f, err := os.OpenFile(path, os.O_WRONLY, os.ModePerm)
|
f, err := os.OpenFile(path, os.O_WRONLY, os.ModePerm)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
COOKIE_NAME = "auth"
|
COOKIE_NAME = "auth"
|
||||||
COOKIE_PATH = "/api"
|
COOKIE_PATH = "/api/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SessionIsValid(ctx App, res http.ResponseWriter, req *http.Request) {
|
func SessionIsValid(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue