Skip to content

Commit ee301c1

Browse files
enghitalowaghanza
andauthored
V: fix dockerfile (the-benchmarker#7137)
* Update Dockerfile * Update Dockerfile * Update config.yaml * unclude `-cc gcc` * v fmt -w main.v * fmt * use clang as compiler * fix * update info * remove broken apps * revert * fix vex * ops * vex is not updated sice 22/March/2023 * vex is not updated sice Dec 4, 2023 * fix v versions * trying a new version * update host * try run pico with latest versions * Update v/vex/config.yaml Co-authored-by: Marwan Rabbâa <[email protected]> * change thevlang/vlang:debian-dev to debian * CMD [bash] * ops * fix * install git * install clang * install tcc --------- Co-authored-by: Marwan Rabbâa <[email protected]>
1 parent 9c35f74 commit ee301c1

File tree

8 files changed

+56
-28
lines changed

8 files changed

+56
-28
lines changed

v/Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
FROM thevlang/vlang:debian as build
1+
FROM debian as build
2+
3+
RUN apt-get -qq update
4+
RUN apt-get -qy install build-essential git clang tcc
5+
6+
ENV PATH=/opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7+
8+
WORKDIR /opt/vlang
9+
10+
RUN git clone --depth 1 https://github.com/vlang/v /opt/vlang && make
11+
12+
RUN ln -s /opt/vlang/v /usr/bin/v
213

314
WORKDIR /app
415

@@ -10,9 +21,9 @@ WORKDIR /app
1021
RUN {{{.}}}
1122
{{/bootstrap}}
1223

13-
RUN v . -prod -o server
24+
RUN v . {{#build_flags}} {{{.}}} {{/build_flags}} -o server
1425

15-
FROM alpine
26+
FROM debian
1627

1728
WORKDIR /app
1829

v/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language:
2-
version: 0.4
2+
version: latest
33
files:
44
- "**/*.v"
55
- server

v/pico/config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
framework:
22
github: vlang/v
3-
version: 0.4
3+
version: weekly.2024.03
4+
5+
bootstrap:
6+
- cd /opt/vlang && git fetch --all --tags && git checkout tags/weekly.2024.03 && make && v -version && cd /app
7+
8+
build_flags:
9+
- -prod -cc clang

v/pico/main.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn callback(data voidptr, req picohttpparser.Request, mut res picohttpparser.Res
2020
}
2121

2222
fn main() {
23-
mut server := picoev.new(port: 3000, cb: callback)
23+
mut server := picoev.new(port: 3000, host: '0.0.0.0', cb: callback)
24+
2425
server.serve()
2526
}

v/vex/config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
framework:
22
github: nedpals/vex
3-
version: 0.3.5
3+
version: 0.3
44

55
bootstrap:
66
- v install nedpals.vex
7+
- cd /opt/vlang && git fetch --all --tags && git checkout tags/weekly.2023.50 && make && v -version && cd /app
8+
9+
build_flags:
10+
- -prod -cc clang

v/vex/main.v

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import nedpals.vex.server
55
import nedpals.vex.ctx
66

77
fn main() {
8-
mut app := router.new()
8+
mut app := router.new()
99

10-
app.route(.get, '/', fn (req &ctx.Req, mut res ctx.Resp) {
11-
res.send('', 200)
12-
})
10+
app.route(.get, '/', fn (req &ctx.Req, mut res ctx.Resp) {
11+
res.send('', 200)
12+
})
1313

14-
app.route(.get, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
15-
res.send('', 200)
16-
})
14+
app.route(.get, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
15+
res.send('', 200)
16+
})
1717

18-
app.route(.get, '/user/:id', fn (req &ctx.Req, mut res ctx.Resp) {
19-
res.send(req.params['id'], 200)
20-
})
18+
app.route(.get, '/user/:id', fn (req &ctx.Req, mut res ctx.Resp) {
19+
res.send(req.params['id'], 200)
20+
})
2121

22-
app.route(.post, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
23-
res.send('', 200)
24-
})
22+
app.route(.post, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
23+
res.send('', 200)
24+
})
2525

26-
server.serve(app, 3000)
27-
}
26+
server.serve(app, 3000)
27+
}

v/vweb/config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
framework:
22
github: vlang/v
3-
version: 0.4
3+
version: weekly.2024.03
4+
5+
bootstrap:
6+
- cd /opt/vlang && git fetch --all --tags && git checkout tags/weekly.2024.03 && make && v -version && cd /app
7+
8+
build_flags:
9+
- -prod -cc gcc

v/vweb/main.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import vweb
22

33
struct App {
4-
vweb.Context
4+
vweb.Context
55
}
66

7-
["/"]
7+
@['/']
88
fn (mut app App) index() vweb.Result {
99
return app.text('')
1010
}
1111

12-
['/user/:id']
12+
@['/user/:id']
1313
fn (mut app App) get_user_id(id string) vweb.Result {
1414
return app.text(id)
1515
}
1616

17-
['/user'; post]
17+
@['/user'; post]
1818
fn (mut app App) post_user() vweb.Result {
1919
return app.text('')
2020
}
2121

2222
fn main() {
2323
vweb.run(&App{}, 3000)
24-
}
24+
}

0 commit comments

Comments
 (0)