Smaller docker image for deployment

This commit is contained in:
Dimitri Lozeve 2022-09-19 22:20:25 +02:00
parent 4516614a8b
commit c21bbbb559
2 changed files with 16 additions and 6 deletions

View file

@ -1,10 +1,20 @@
FROM gerbil/alpine FROM gerbil/alpine as builder
RUN gxpkg install github.com/dlozeve/fancy RUN gxpkg install github.com/dlozeve/fancy
COPY . . COPY . .
RUN ./build.ss lib RUN ./build.ss lib
RUN ./build.ss server RUN gxc -exe -static -cc-options -static -ld-options -lz -o server server.ss
FROM alpine:latest
RUN adduser -D appuser
# Copy the server binary
COPY --from=builder /src/server /
USER appuser
WORKDIR /home/appuser
EXPOSE 8080 EXPOSE 8080
CMD ["/src/server"] CMD ["/server"]

View file

@ -1,6 +1,6 @@
# fly.toml file generated for sncf-bot on 2022-09-19T19:20:26+02:00 # fly.toml file generated for sncf on 2022-09-19T22:02:14+02:00
app = "sncf-bot" app = "sncf"
kill_signal = "SIGINT" kill_signal = "SIGINT"
kill_timeout = 5 kill_timeout = 5
processes = [] processes = []
@ -23,7 +23,7 @@ processes = []
type = "connections" type = "connections"
[[services.ports]] [[services.ports]]
force_https = true force_https = false
handlers = ["http"] handlers = ["http"]
port = 80 port = 80