Skip to content

Commit 756a201

Browse files
author
Fabian Wunsch
committed
Merge tag 'v1.14.0' into order-details
2 parents 69bf9f6 + fa42997 commit 756a201

36 files changed

+4004
-3042
lines changed

.docker/partdb-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ if [ -d /var/www/html/var/db ]; then
3939
fi
4040
fi
4141

42-
# Start PHP-FPM
43-
service php8.1-fpm start
42+
# Start PHP-FPM (the PHP_VERSION is replaced by the configured version in the Dockerfile)
43+
service phpPHP_VERSION-fpm start
4444

4545
# first arg is `-f` or `--some-option` (taken from https://github.com/docker-library/php/blob/master/8.2/bullseye/apache/docker-php-entrypoint)
4646
if [ "${1#-}" != "$1" ]; then

.env

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,40 @@ PROVIDER_LCSC_ENABLED=0
181181
# The currency to get prices in (e.g. EUR, USD, etc.)
182182
PROVIDER_LCSC_CURRENCY=EUR
183183

184+
# Oemsecrets Provider API 3.0.1:
185+
# You can get your API key from https://www.oemsecrets.com/api
186+
PROVIDER_OEMSECRETS_KEY=
187+
# The country you want the output for
188+
PROVIDER_OEMSECRETS_COUNTRY_CODE=DE
189+
# Available country code are:
190+
# AD, AE, AQ, AR, AT, AU, BE, BO, BR, BV, BY, CA, CH, CL, CN, CO, CZ, DE, DK, EC, EE, EH,
191+
# ES, FI, FK, FO, FR, GB, GE, GF, GG, GI, GL, GR, GS, GY, HK, HM, HR, HU, IE, IM, IN, IS,
192+
# IT, JM, JP, KP, KR, KZ, LI, LK, LT, LU, MC, MD, ME, MK, MT, NL, NO, NZ, PE, PH, PL, PT,
193+
# PY, RO, RS, RU, SB, SD, SE, SG, SI, SJ, SK, SM, SO, SR, SY, SZ, TC, TF, TG, TH, TJ, TK,
194+
# TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VE, VG, VI, VN, VU, WF, YE,
195+
# ZA, ZM, ZW
196+
#
197+
# The currency you want the prices to be displayed in
198+
PROVIDER_OEMSECRETS_CURRENCY=EUR
199+
# Available currency are:AUD, CAD, CHF, CNY, DKK, EUR, GBP, HKD, ILS, INR, JPY, KRW, NOK,
200+
# NZD, RUB, SEK, SGD, TWD, USD
201+
#
202+
# If PROVIDER_OEMSECRETS_ZERO_PRICE is set to 0, distributors with zero prices
203+
# will be discarded from the creation of a new part (set to 1 otherwise)
204+
PROVIDER_OEMSECRETS_ZERO_PRICE=0
205+
#
206+
# When PROVIDER_OEMSECRETS_SET_PARAM is set to 1 the parameters for the part are generated
207+
# from the description transforming unstructured descriptions into structured parameters;
208+
# each parameter in description should have the form: "...;name1:value1;name2:value2"
209+
PROVIDER_OEMSECRETS_SET_PARAM=1
210+
#
211+
# This environment variable determines the sorting criteria for product results.
212+
# The sorting process first arranges items based on the provided keyword.
213+
# Then, if set to 'C', it further sorts by completeness (prioritizing items with the most
214+
# detailed information). If set to 'M', it further sorts by manufacturer name.
215+
#If unset or set to any other value, no sorting is performed.
216+
PROVIDER_OEMSECRETS_SORT_CRITERIA=C
217+
184218
##################################################################################
185219
# EDA integration related settings
186220
##################################################################################

Dockerfile

Lines changed: 115 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,64 @@
1-
FROM debian:bullseye-slim
1+
ARG BASE_IMAGE=debian:bookworm-slim
2+
ARG PHP_VERSION=8.2
3+
4+
FROM ${BASE_IMAGE} AS base
5+
ARG PHP_VERSION
26

37
# Install needed dependencies for PHP build
48
#RUN apt-get update && apt-get install -y pkg-config curl libcurl4-openssl-dev libicu-dev \
59
# libpng-dev libjpeg-dev libfreetype6-dev gnupg zip libzip-dev libjpeg62-turbo-dev libonig-dev libxslt-dev libwebp-dev vim \
610
# && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
711

8-
RUN apt-get update && apt-get -y install apt-transport-https lsb-release ca-certificates curl zip mariadb-client postgresql-client \
12+
RUN apt-get update && apt-get -y install \
13+
apt-transport-https \
14+
lsb-release \
15+
ca-certificates \
16+
curl \
17+
zip \
18+
mariadb-client \
19+
postgresql-client \
920
&& curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg \
1021
&& sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' \
1122
&& apt-get update && apt-get upgrade -y \
12-
&& apt-get install -y apache2 php8.1 php8.1-fpm php8.1-opcache php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-bcmath php8.1-intl php8.1-zip php8.1-xsl php8.1-sqlite3 php8.1-mysql php8.1-pgsql gpg sudo \
13-
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*;
23+
&& apt-get install -y \
24+
apache2 \
25+
php${PHP_VERSION} \
26+
php${PHP_VERSION}-fpm \
27+
php${PHP_VERSION}-opcache \
28+
php${PHP_VERSION}-curl \
29+
php${PHP_VERSION}-gd \
30+
php${PHP_VERSION}-mbstring \
31+
php${PHP_VERSION}-xml \
32+
php${PHP_VERSION}-bcmath \
33+
php${PHP_VERSION}-intl \
34+
php${PHP_VERSION}-zip \
35+
php${PHP_VERSION}-xsl \
36+
php${PHP_VERSION}-sqlite3 \
37+
php${PHP_VERSION}-mysql \
38+
php${PHP_VERSION}-pgsql \
39+
gpg \
40+
sudo \
41+
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/* \
42+
# Create workdir and set permissions if directory does not exists
43+
&& mkdir -p /var/www/html \
44+
&& chown -R www-data:www-data /var/www/html \
45+
# delete the "index.html" that installing Apache drops in here
46+
&& rm -rvf /var/www/html/*
1447

15-
ENV APACHE_CONFDIR /etc/apache2
16-
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
48+
# Install node and yarn
49+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
50+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
51+
curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
52+
apt-get update && apt-get install -y \
53+
nodejs \
54+
yarn \
55+
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
1756

18-
# Create workdir and set permissions if directory does not exists
19-
RUN mkdir -p /var/www/html && chown -R www-data:www-data /var/www/html
57+
# Install composer
58+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
59+
60+
ENV APACHE_CONFDIR=/etc/apache2
61+
ENV APACHE_ENVVARS=$APACHE_CONFDIR/envvars
2062

2163
# Configure apache 2 (taken from https://github.com/docker-library/php/blob/master/8.2/bullseye/apache/Dockerfile)
2264
# generically convert lines like
@@ -27,107 +69,111 @@ RUN mkdir -p /var/www/html && chown -R www-data:www-data /var/www/html
2769
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
2870
RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
2971
set -eux; . "$APACHE_ENVVARS"; \
30-
# delete the "index.html" that installing Apache drops in here
31-
rm -rvf /var/www/html/*; \
3272
\
3373
# logs should go to stdout / stderr
3474
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
3575
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
3676
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
3777
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR";
3878

39-
# Enable php-fpm
40-
RUN a2enmod proxy_fcgi setenvif && a2enconf php8.1-fpm
79+
# ---
4180

81+
FROM scratch AS apache-config
82+
ARG PHP_VERSION
4283
# Configure php-fpm to log to stdout of the container (stdout of PID 1)
4384
# We have to use /proc/1/fd/1 because /dev/stdout or /proc/self/fd/1 does not point to the container stdout (because we use apache as entrypoint)
4485
# We also disable the clear_env option to allow the use of environment variables in php-fpm
45-
RUN { \
46-
echo '[global]'; \
47-
echo 'error_log = /proc/1/fd/1'; \
48-
echo; \
49-
echo '[www]'; \
50-
echo 'access.log = /proc/1/fd/1'; \
51-
echo 'catch_workers_output = yes'; \
52-
echo 'decorate_workers_output = no'; \
53-
echo 'clear_env = no'; \
54-
} | tee "/etc/php/8.1/fpm/pool.d/zz-docker.conf"
86+
COPY <<EOF /etc/php/${PHP_VERSION}/fpm/pool.d/zz-docker.conf
87+
[global]
88+
error_log = /proc/1/fd/1
89+
90+
[www]
91+
access.log = /proc/1/fd/1
92+
catch_workers_output = yes
93+
decorate_workers_output = no
94+
clear_env = no
95+
EOF
5596

5697
# PHP files should be handled by PHP, and should be preferred over any other file type
57-
RUN { \
58-
echo '<FilesMatch \.php$>'; \
59-
echo '\tSetHandler application/x-httpd-php'; \
60-
echo '</FilesMatch>'; \
61-
echo; \
62-
echo 'DirectoryIndex disabled'; \
63-
echo 'DirectoryIndex index.php index.html'; \
64-
echo; \
65-
echo '<Directory /var/www/>'; \
66-
echo '\tOptions -Indexes'; \
67-
echo '\tAllowOverride All'; \
68-
echo '</Directory>'; \
69-
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
70-
&& a2enconf docker-php
98+
COPY <<EOF /etc/apache2/conf-available/docker-php.conf
99+
<FilesMatch \\.php$>
100+
SetHandler application/x-httpd-php
101+
</FilesMatch>
102+
103+
DirectoryIndex disabled
104+
DirectoryIndex index.php index.html
105+
106+
<Directory /var/www/>
107+
Options -Indexes
108+
AllowOverride All
109+
</Directory>
110+
EOF
71111

72112
# Enable opcache and configure it recommended for symfony (see https://symfony.com/doc/current/performance.html)
73-
RUN \
74-
{ \
75-
echo 'opcache.memory_consumption=256'; \
76-
echo 'opcache.max_accelerated_files=20000'; \
77-
echo 'opcache.validate_timestamp=0'; \
78-
# Configure Realpath cache for performance
79-
echo 'realpath_cache_size=4096K'; \
80-
echo 'realpath_cache_ttl=600'; \
81-
} > /etc/php/8.1/fpm/conf.d/symfony-recommended.ini
113+
COPY <<EOF /etc/php/${PHP_VERSION}/fpm/conf.d/symfony-recommended.ini
114+
opcache.memory_consumption=256
115+
opcache.max_accelerated_files=20000
116+
opcache.validate_timestamp=0
117+
# Configure Realpath cache for performance
118+
realpath_cache_size=4096K
119+
realpath_cache_ttl=600
120+
EOF
82121

83122
# Increase upload limit and enable preloading
84-
RUN \
85-
{ \
86-
echo 'upload_max_filesize=256M'; \
87-
echo 'post_max_size=300M'; \
88-
echo 'opcache.preload_user=www-data'; \
89-
echo 'opcache.preload=/var/www/html/config/preload.php'; \
90-
} > /etc/php/8.1/fpm/conf.d/partdb.ini
123+
COPY <<EOF /etc/php/${PHP_VERSION}/fpm/conf.d/partdb.ini
124+
upload_max_filesize=256M
125+
post_max_size=300M
126+
opcache.preload_user=www-data
127+
opcache.preload=/var/www/html/config/preload.php
128+
EOF
91129

92-
# Install node and yarn
93-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
94-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
95-
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get update && apt-get install -y nodejs yarn && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
130+
COPY ./.docker/symfony.conf /etc/apache2/sites-available/symfony.conf
96131

97-
# Install composer
98-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
132+
# ---
99133

134+
FROM base
135+
ARG PHP_VERSION
100136

101137
# Set working dir
102138
WORKDIR /var/www/html
139+
COPY --from=apache-config / /
103140
COPY --chown=www-data:www-data . .
104141

105142
# Setup apache2
106-
RUN a2dissite 000-default.conf
107-
COPY ./.docker/symfony.conf /etc/apache2/sites-available/symfony.conf
108-
RUN a2ensite symfony.conf
109-
RUN a2enmod rewrite
143+
RUN a2dissite 000-default.conf && \
144+
a2ensite symfony.conf && \
145+
# Enable php-fpm
146+
a2enmod proxy_fcgi setenvif && \
147+
a2enconf php${PHP_VERSION}-fpm && \
148+
a2enconf docker-php && \
149+
a2enmod rewrite
110150

111151
# Install composer and yarn dependencies for Part-DB
112152
USER www-data
113-
RUN composer install -a --no-dev && composer clear-cache
114-
RUN yarn install --network-timeout 600000 && yarn build && yarn cache clean && rm -rf node_modules/
153+
RUN composer install -a --no-dev && \
154+
composer clear-cache
155+
RUN yarn install --network-timeout 600000 && \
156+
yarn build && \
157+
yarn cache clean && \
158+
rm -rf node_modules/
115159

116160
# Use docker env to output logs to stdout
117161
ENV APP_ENV=docker
118162
ENV DATABASE_URL="sqlite:///%kernel.project_dir%/uploads/app.db"
119163

120164
USER root
121165

122-
# Copy entrypoint to /usr/local/bin and make it executable
123-
RUN cp ./.docker/partdb-entrypoint.sh /usr/local/bin/partdb-entrypoint.sh && chmod +x /usr/local/bin/partdb-entrypoint.sh
124-
# Copy apache2-foreground to /usr/local/bin and make it executable
125-
RUN cp ./.docker/apache2-foreground /usr/local/bin/apache2-foreground && chmod +x /usr/local/bin/apache2-foreground
166+
# Replace the php version placeholder in the entry point, with our php version
167+
RUN sed -i "s/PHP_VERSION/${PHP_VERSION}/g" ./.docker/partdb-entrypoint.sh
168+
169+
# Copy entrypoint and apache2-foreground to /usr/local/bin and make it executable
170+
RUN install ./.docker/partdb-entrypoint.sh /usr/local/bin && \
171+
install ./.docker/apache2-foreground /usr/local/bin
126172
ENTRYPOINT ["partdb-entrypoint.sh"]
127173
CMD ["apache2-foreground"]
128174

129175
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
130176
STOPSIGNAL SIGWINCH
131177

132178
EXPOSE 80
133-
VOLUME ["/var/www/html/uploads", "/var/www/html/public/media"]
179+
VOLUME ["/var/www/html/uploads", "/var/www/html/public/media"]

Dockerfile-frankenphp

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
22

3-
RUN apt-get update && apt-get -y install curl zip mariadb-client postgresql-client file acl git gettext ca-certificates gnupg \
3+
RUN apt-get update && apt-get -y install \
4+
curl \
5+
ca-certificates \
6+
mariadb-client \
7+
postgresql-client \
8+
file \
9+
acl \
10+
git \
11+
gettext \
12+
gnupg \
13+
zip \
414
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*;
515

6-
# Create workdir and set permissions if directory does not exists
7-
RUN mkdir -p /app
8-
WORKDIR /app
16+
# Install node and yarn
17+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
18+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
19+
curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
20+
apt-get update && apt-get install -y \
21+
nodejs yarn \
22+
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
923

1024
# Install PHP
1125
RUN set -eux; \
@@ -33,15 +47,13 @@ ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
3347

3448
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
3549

36-
# Install node and yarn
37-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
38-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
39-
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get update && apt-get install -y nodejs yarn && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
40-
4150
# Install composer
4251
ENV COMPOSER_ALLOW_SUPERUSER=1
4352
#COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
4453

54+
# Create workdir and set permissions if directory does not exists
55+
WORKDIR /app
56+
4557
# prevent the reinstallation of vendors at every changes in the source code
4658
COPY --link composer.* symfony.* ./
4759
RUN set -eux; \
@@ -58,7 +70,10 @@ RUN set -eux; \
5870
composer run-script --no-dev post-install-cmd; \
5971
chmod +x bin/console; sync;
6072

61-
RUN yarn install --network-timeout 600000 && yarn build && yarn cache clean && rm -rf node_modules/
73+
RUN yarn install --network-timeout 600000 && \
74+
yarn build && \
75+
yarn cache clean && \
76+
rm -rf node_modules/
6277

6378
# Use docker env to output logs to stdout
6479
ENV APP_ENV=docker
@@ -83,4 +98,4 @@ ENV XDG_DATA_HOME /data
8398
EXPOSE 80
8499
EXPOSE 443
85100
EXPOSE 443/udp
86-
EXPOSE 2019
101+
EXPOSE 2019

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.3
1+
1.14.0

assets/css/app/images.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
.part-table-image {
5252
max-height: 40px;
5353
object-fit: contain;
54-
width: 100%;
5554
}
5655

5756
.part-info-image {
@@ -61,4 +60,4 @@
6160

6261
.object-fit-cover {
6362
object-fit: cover;
64-
}
63+
}

0 commit comments

Comments
 (0)