build(docker): optimize image size
By executing the curl call directly as the nobody user Closes #1012 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
b2bacbf6eb
commit
f34099d384
@ -1,6 +1,10 @@
|
|||||||
_build
|
_build
|
||||||
CONTRIBUTING.md
|
CONTRIBUTING.md
|
||||||
|
coverage
|
||||||
|
demo
|
||||||
deps
|
deps
|
||||||
|
doc
|
||||||
|
docs
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
Dockerfile
|
Dockerfile
|
||||||
.elixir_ls
|
.elixir_ls
|
||||||
@ -17,3 +21,6 @@ SECURITY.md
|
|||||||
ssh_match_hostname
|
ssh_match_hostname
|
||||||
package-lock.json
|
package-lock.json
|
||||||
node_modules
|
node_modules
|
||||||
|
playwright-report
|
||||||
|
test
|
||||||
|
tests
|
||||||
|
@ -375,7 +375,7 @@ package-app-dev:
|
|||||||
- ${APP_ASSET}
|
- ${APP_ASSET}
|
||||||
|
|
||||||
# Packaging app for multi-arch
|
# Packaging app for multi-arch
|
||||||
multi-arch-release:
|
package-multi-arch-release:
|
||||||
stage: build
|
stage: build
|
||||||
image: docker:24
|
image: docker:24
|
||||||
variables:
|
variables:
|
||||||
|
@ -51,7 +51,7 @@ LABEL org.opencontainers.image.title="mobilizon" \
|
|||||||
org.opencontainers.image.created=$BUILD_DATE
|
org.opencontainers.image.created=$BUILD_DATE
|
||||||
|
|
||||||
RUN apk add --no-cache curl openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc g++ musl-dev python3-dev pango libxslt-dev ttf-cantarell openssl1.1-compat
|
RUN apk add --no-cache curl openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc g++ musl-dev python3-dev pango libxslt-dev ttf-cantarell openssl1.1-compat
|
||||||
RUN pip install weasyprint pyexcel-ods3
|
RUN pip --no-cache-dir install weasyprint pyexcel-ods3
|
||||||
|
|
||||||
# Create every data directory
|
# Create every data directory
|
||||||
RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads
|
RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads
|
||||||
@ -60,14 +60,14 @@ RUN mkdir -p /var/lib/mobilizon/tzdata && chown nobody:nobody /var/lib/mobilizon
|
|||||||
RUN mkdir -p /var/lib/mobilizon/sitemap && chown nobody:nobody /var/lib/mobilizon/sitemap
|
RUN mkdir -p /var/lib/mobilizon/sitemap && chown nobody:nobody /var/lib/mobilizon/sitemap
|
||||||
RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nobody /var/lib/mobilizon/uploads/exports
|
RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nobody /var/lib/mobilizon/uploads/exports
|
||||||
|
|
||||||
# Get timezone geodata
|
|
||||||
RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets
|
|
||||||
RUN chown -R nobody:nobody /var/lib/mobilizon/timezones
|
|
||||||
|
|
||||||
# Create configuration directory
|
# Create configuration directory
|
||||||
RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon
|
RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon
|
||||||
|
|
||||||
USER nobody
|
USER nobody
|
||||||
|
|
||||||
|
# Get timezone geodata
|
||||||
|
RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets
|
||||||
|
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
|
||||||
ENV MOBILIZON_DOCKER=true
|
ENV MOBILIZON_DOCKER=true
|
||||||
|
@ -2,10 +2,10 @@ FROM elixir:latest
|
|||||||
LABEL maintainer="Thomas Citharel <thomas.citharel@framasoft.org>"
|
LABEL maintainer="Thomas Citharel <thomas.citharel@framasoft.org>"
|
||||||
|
|
||||||
ENV REFRESHED_AT=2023-11-20
|
ENV REFRESHED_AT=2023-11-20
|
||||||
RUN apt-get update -yq && apt-get install -yq build-essential inotify-tools postgresql-client git curl gnupg xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 cmake exiftool python3-pip python3-setuptools
|
RUN apt-get update -yq && apt-get install -yq ca-certificates build-essential inotify-tools postgresql-client git curl gnupg xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 cmake exiftool python3-pip python3-setuptools
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash && apt-get install nodejs -yq
|
RUN mkdir -p /etc/apt/keyrings && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -yq
|
||||||
RUN npm install -g wait-on
|
RUN npm install -g wait-on
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
RUN mix local.hex --force && mix local.rebar --force
|
RUN mix local.hex --force && mix local.rebar --force
|
||||||
RUN pip3 install -Iv weasyprint pyexcel_ods3
|
RUN pip3 --no-cache-dir install -Iv weasyprint pyexcel_ods3
|
||||||
RUN curl https://dbip.mirror.framasoft.org/files/dbip-city-lite-latest.mmdb --output GeoLite2-City.mmdb -s && mkdir -p /usr/share/GeoIP && mv GeoLite2-City.mmdb /usr/share/GeoIP/
|
RUN curl https://dbip.mirror.framasoft.org/files/dbip-city-lite-latest.mmdb --output GeoLite2-City.mmdb -s && mkdir -p /usr/share/GeoIP && mv GeoLite2-City.mmdb /usr/share/GeoIP/
|
||||||
|
Loading…
Reference in New Issue
Block a user