-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.ubuntu
47 lines (35 loc) · 1.4 KB
/
Dockerfile.ubuntu
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
FROM thevlang/vlang:ubuntu-build AS builder
# update packages, to reduce risk of vulnerabilities
RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get upgrade -y \
&& apt-get install --quiet -y openssl upx \
# && apt-get install --quiet -y --no-install-recommends libssl-dev libsqlite3-dev && \
&& apt-get autoclean && apt-get autoremove
# build V
WORKDIR /opt/vlang
RUN git clone https://github.com/vlang/v /opt/vlang \
&& make CC=clang && v -version && v symlink
# copy and build application sources
WORKDIR /src
COPY . .
RUN make build-optimized && make dist
# use vlang ubuntu-base image,
# otherwise use a standard ubuntu but add runtime libraries for openssl (and maybe others)
FROM thevlang/vlang:ubuntu-base AS runtime
LABEL version="1.0.0"
LABEL description="Example vweb (V) webapp Docker Image"
LABEL maintainer="Sandro Martini <[email protected]>"
# update packages, to reduce risk of vulnerabilities
RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get upgrade -y \
&& apt-get autoclean && apt-get autoremove
WORKDIR /app
COPY --from=builder /src/dist/ .
# RUN ls -la /app
# describe port/s opened in the container
EXPOSE 8000
# add an healthcheck by calling the additional script/application
HEALTHCHECK --interval=60s --timeout=10s --start-period=15s CMD ["./healthcheck"]
# ENTRYPOINT [ "/app/vweb-example" ]
CMD [ "./vweb-example" ]
# end.