-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
116 lines (96 loc) · 2.8 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
FROM golang:1.20 AS build_base
LABEL stage=builder
RUN mkdir /compile
COPY supervisor/ /compile
RUN cd /compile && CGO_ENABLED=0 go build -o /compile/supervisor .
FROM alpine:3.15
RUN apk add ca-certificates curl && mkdir /app && touch /app/.isdocker
RUN \
mkdir -p \
/app \
/config \
/defaults
# add local files
COPY root/ /
# install packages
RUN \
echo "**** installing os packages ****" && \
apk add --no-cache \
apache2-utils \
bash \
ca-certificates \
coreutils \
curl \
evtest \
libressl3.4-libssl \
nano \
nginx \
openssl \
php8 \
php8-curl \
php8-fileinfo \
php8-fpm \
php8-gettext \
php8-json \
php8-mbstring \
php8-openssl \
php8-pdo \
php8-pdo_sqlite \
php8-redis \
php8-session \
php8-simplexml \
php8-sockets \
php8-sqlite3 \
php8-xml \
php8-xmlwriter \
php8-zlib \
procps \
redis \
screen \
shadow \
sudo \
tzdata && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/conf.d/default.conf && \
chown redis:redis /etc/redis.conf && \
useradd -d /config -s /bin/false barcodebuddy && \
chmod 755 /etc && \
chown barcodebuddy:barcodebuddy -R /var/log/php8 && \
ln -s /usr/bin/php8 /usr/bin/php && \
ln -s /config /data
# set version label
ARG BUILD_DATE
ARG VERSION
ARG BBUDDY_RELEASE
LABEL build_version="BarcodeBuddy ${VERSION} Build ${BUILD_DATE}"
LABEL maintainer="Marc Ole Bulling"
RUN \
echo "**** Installing BarcodeBuddy ****" && \
mkdir -p /app/bbuddy && \
if [ -z ${BBUDDY_RELEASE+x} ]; then \
BBUDDY_RELEASE=$(curl -sX GET "https://api.github.com/repos/Forceu/barcodebuddy/releases/latest" \
| awk '/tag_name/{print $4; exit}' FS='[""]'); \
fi && \
curl -o \
/tmp/bbuddy.tar.gz -L \
"https://github.com/Forceu/barcodebuddy/archive/${BBUDDY_RELEASE}.tar.gz" && \
tar xf \
/tmp/bbuddy.tar.gz -C \
/app/bbuddy/ --strip-components=1 && \
sed -i 's/[[:blank:]]*const[[:blank:]]*IS_DOCKER[[:blank:]]*=[[:blank:]]*false;/const IS_DOCKER = true;/g' /app/bbuddy/config-dist.php && \
echo "Set disable_coredump false" > /etc/sudo.conf && \
sed -i 's/SCRIPT_LOCATION=.*/SCRIPT_LOCATION="\/app\/bbuddy\/index.php"/g' /app/bbuddy/example/grabInput.sh && \
sed -i 's/pm.max_children = 5/pm.max_children = 20/g' /etc/php8/php-fpm.d/www.conf && \
sed -i 's/WWW_USER=.*/WWW_USER="barcodebuddy"/g' /app/bbuddy/example/grabInput.sh && \
sed -i 's/IS_DOCKER=.*/IS_DOCKER=true/g' /app/bbuddy/example/grabInput.sh && \
sed -i 's/const DEFAULT_USE_REDIS =.*/const DEFAULT_USE_REDIS = "1";/g' /app/bbuddy/incl/db.inc.php && \
rm -rf \
/root/.cache \
/tmp/*
#Bug in sudo requires disable_coredump
#Max children need to be a higher value, otherwise websockets / SSE might not work properly
COPY --from=build_base /compile/supervisor /app/supervisor
EXPOSE 80 443
VOLUME /config
CMD ["/app/supervisor"]