-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsnapcraft.yaml
145 lines (123 loc) · 3.36 KB
/
snapcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: fabrica
base: core18
version: '1.1.0'
summary: your own snap build factory
description: |
Fabrica is a web service to be run on an lxd appliance. It spawns a
web ui that allows you to point to cloneable git trees, initializes
lxd containers and builds snap packages of the provided source trees.
To use fabrica you can use the steps below
snap install lxd
sudo lxd init # hit enter for all questions
snap install fabrica
snap connect fabrica:lxd lxd:lxd
snap connect fabrica:mount-observe
snap connect fabrica:system-observe
snap connect fabrica:ssh-keys
Now fabrica will come up on port 8000.
Point your web browser to http://localhost:8000 (or to the external
IP instead of localhost) and add some git tree to it.
Note that in its current state fabrica only builds snap packages for
the used host architecture (i.e. to build armhf or arm64 snaps, you
need to use a raspberry Pi4 and install lxd and fabrica on it)
The branches are checked every 5 minutes for new commits. Builds start
automatically when a new commit is detected.
Since the service is currently only available via http and also has no
authentication management, it is recommended to only use it in
in-house setups.
Issues and bugs should be filed at
https://github.com/ogra1/fabrica/issues
grade: stable
confinement: strict
architectures:
- build-on: armhf
- build-on: arm64
- build-on: amd64
- build-on: s390x
- build-on: ppc64el
layout:
/etc/ssh:
bind: $SNAP_DATA/ssh
apps:
init:
command: bin/init.py
daemon: simple
plugs:
- lxd
- mount-observe
- network-bind
web:
command: bin/web
daemon: simple
plugs:
- lxd
- mount-observe
- network
- network-bind
- system-observe
- ssh-keys
watch:
command: bin/watch
daemon: simple
plugs:
- lxd
- mount-observe
- network
- network-bind
- system-observe
- ssh-keys
parts:
react:
plugin: nil
source: .
override-build: |
# Install node and npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
. "$NVM_DIR/bash_completion"
nvm install lts/*
nvm run node --version
cd webapp
npm install --unsafe-perm
npm run build
mkdir -p $SNAPCRAFT_PART_INSTALL/static/
cp -r build/static/css $SNAPCRAFT_PART_INSTALL/static/
cp -r build/static/js $SNAPCRAFT_PART_INSTALL/static/
cp -r build/static/images $SNAPCRAFT_PART_INSTALL/static/
cp build/* $SNAPCRAFT_PART_INSTALL/static/ || :
build-packages:
- curl
- python-minimal
- python-dev
pylxd:
plugin: python
python-packages:
- cryptography == 3.3.2
- pylxd
build-packages:
- libffi-dev
- libssl-dev
scripts:
source: .
plugin: nil
override-build: |
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp bin/init.py $SNAPCRAFT_PART_INSTALL/bin/
cp -r ssh/ $SNAPCRAFT_PART_INSTALL
chmod 644 $SNAPCRAFT_PART_INSTALL/ssh/*
application:
plugin: go
source: .
source-type: git
build-packages:
- gcc
stage-packages:
- git
- libcurl4-openssl-dev
bin:
source: snap/local
plugin: dump
organize:
"*": /bin/