Closed nanawel closed 9 months ago
The base image is not rust, but busybox, which is indeed almost empty, and provides very lightweight images.
The best way to make new image variants is to add a new target in our Dockerfile, and update our release GitHub actions. Could you open a pull request for that? Alpine is probably not the best option given that or binaries depend on glibc, but making an image based on debian slim should be as simple as copying the binary into the image.
The base image is not rust, but busybox,
Right! I didn't read to the end of the file.
The best way to make new image variants is to add a new target in our Dockerfile, and update our release GitHub actions. Could you open a pull request for that?
I'm not familiar with GA but I'll see what I can do, sure. :+1:
Don't hesitate to ask for help here if you need :) I'll be happy to collaborate.
@nanawel I updated the README to recommend against using the default image as a base, and instead using something like
FROM debian:stable-slim
COPY --from=lovasoa/sqlpage:latest /usr/local/bin/sqlpage /usr/local/bin/sqlpage
It works because SQLPage is a single static binary without dependencies.
Thanks a lot! I could not find the time to work on this, unfortunately :confused: Your proposal seems perfect to me, I'll try it.
To anyone interested, a working Debian-based Dockerfile
similar to what the default image provides would be:
ARG sqlpage_version
FROM lovasoa/sqlpage:${sqlpage_version:-latest} as sqlpage_base_image
FROM debian:bookworm-slim
COPY --from=sqlpage_base_image /usr/local/bin/sqlpage /usr/local/bin/sqlpage
ARG sqlpage_version
ENV SQLPAGE_VERSION=${sqlpage_version:-unknown}
RUN addgroup --system sqlpage \
&& adduser --system --no-create-home --ingroup sqlpage sqlpage
USER sqlpage
WORKDIR /var/www
EXPOSE 8080
CMD ["/usr/local/bin/sqlpage"]
FYI I tried to use alpine:3
first but the binary won't run. I suppose it's because it's dynamically linked to the glibc. If you need it anyway, you should take a look at this documentation: https://wiki.alpinelinux.org/wiki/Running_glibc_programs
I think you don't need the first FROM
. You can directly COPY --from=lovasoa/sqlpage:latest
Not if you want to be able to customize the version using build args.
Hi, I was attempting to upgrade a local project to sqlpage 0.15.x but my build failed with the following error:
This is because the base Rust image is
slim
and it does not provideapk
in order to install additional dependencies. My Dockerfile is as follows:The
RUN
used to work with previous versions (at least 0.11.x I guess) but not anymore.This is an important issue IMHO because it means that all date-related processings will be performed in the UTC timezone, and something as simple as "displaying the current date/time" for the user will be wrong most of the time.
Do you think you could provide two flavors of each build, one using
rust:<version>-slim
with focus on extra-low weight, and one usingrust:<version>-alpine
which could hence be more customizable?