Add GCC/C example.

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2017-09-06 13:05:00 +01:00
parent fbe846aa31
commit 0d1962de1e
5 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,26 @@
FROM alpine:3.6 as builder
RUN apk add --no-cache curl \
&& curl -SL https://github.com/alexellis/faas/releases/download/0.6.4/fwatchdog > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apk --no-cache del curl
WORKDIR /root/
RUN apk add --no-cache gcc \
musl-dev
COPY main.c .
RUN gcc main.c -static -o /main \
&& chmod +x /main \
&& /main
FROM scratch
COPY --from=builder /main /
COPY --from=builder /usr/bin/fwatchdog /
COPY --from=builder /tmp /tmp
ENV fprocess="/main"
CMD ["/fwatchdog"]

View File

@ -0,0 +1,9 @@
#include<stdio.h>
int main() {
printf("Hello world\n");
return 0;
}