Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace base image to alpine #240

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM httpd:2.4
ARG ARCH=amd64
FROM $ARCH/httpd:2.4-alpine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the ARCH, we don't want to build only for one architecture.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also docker will automatically pick the right arch depending on the host I believe.


RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
RUN apk update && apk add \
nano \
openssl \
gettext
Expand Down
2 changes: 1 addition & 1 deletion apache/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# if there's no ssl certificate yet create it
if [ ! -f "/usr/local/apache2/conf/server.crt" ]; then
Expand Down
8 changes: 7 additions & 1 deletion bin/tbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

script_path="$( cd "$(dirname "$0")" ; pwd -P )"
project_path="$( cd $script_path && cd ..; pwd -P )"
export $(grep -E -v '^#' $project_path/.env | xargs)

$script_path/tdocker build "$@"
# Check the OS and make image for that OS
if [ $(uname -m) == "arm64" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't it automatically use the one you are currently running?

$script_path/tdocker build --build-arg ARCH="arm64v8" "$@"
else
$script_path/tdocker build "$@"
fi
17 changes: 10 additions & 7 deletions compose/pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"
services:

pgsql93:
image: postgres:9.3
image: postgres:9.3-alpine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the pgsql images have been changed to alpine in #250

container_name: totara_pgsql93
ports:
- "5493:5432"
Expand All @@ -20,7 +20,7 @@ services:
- totara

pgsql96:
image: postgres:9.6
image: postgres:9.6-alpine
container_name: totara_pgsql96
ports:
- "5496:5432"
Expand All @@ -39,13 +39,14 @@ services:
- totara

pgsql10:
image: postgres:10.6
image: postgres:10-alpine
container_name: totara_pgsql10
ports:
- "5410:5432"
environment:
TZ: ${TIME_ZONE}
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_HOST_AUTH_METHOD: trust
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens without this environment variable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I try to remove the db password from local image.

command:
postgres -c 'config_file=/etc/postgresql/postgresql.conf'
volumes:
Expand All @@ -57,13 +58,14 @@ services:
- totara

pgsql11:
image: postgres:11.6
image: postgres:11-alpine
container_name: totara_pgsql11
ports:
- "5411:5432"
environment:
TZ: ${TIME_ZONE}
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_HOST_AUTH_METHOD: trust
command:
postgres -c 'config_file=/etc/postgresql/postgresql.conf'
volumes:
Expand All @@ -75,13 +77,14 @@ services:
- totara

pgsql:
image: postgres:12.1
image: postgres:12-alpine
container_name: totara_pgsql12
ports:
- "5432:5432"
environment:
TZ: ${TIME_ZONE}
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_HOST_AUTH_METHOD: trust
command:
postgres -c 'config_file=/etc/postgresql/postgresql.conf'
volumes:
Expand All @@ -93,7 +96,7 @@ services:
- totara

pgsql13:
image: postgres:13.0
image: postgres:13-alpine
container_name: totara_pgsql13
ports:
- "5442:5432"
Expand All @@ -112,7 +115,7 @@ services:
- totara

pgsql14:
image: postgres:14.0
image: postgres:14-alpine
container_name: totara_pgsql14
ports:
- "5443:5432"
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
# docker-compose -f docker-compose.yml -f compose/nginx.yml -f compose/pgsql.yml -f compose/php.yml up -d pgsql php-7.3

nodejs:
image: node:16
image: node:16-alpine3.16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe should be node:16-alpine?

container_name: totara_nodejs
environment:
TZ: ${TIME_ZONE}
Expand All @@ -28,7 +28,8 @@ services:
- totara

redis:
image: redis
image: redis:alpine
container_name: totara_redis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could create problems if someone has been running it before, conflicts with existing containers. Not strictly necessay anyway, so maybe it's safer to not add container names in this patch.

# activate persistency
command: "redis-server --appendonly yes"
environment:
Expand All @@ -39,7 +40,8 @@ services:
- totara

memcached:
image: memcached
image: memcached:alpine
container_name: totara_memcached
environment:
TZ: ${TIME_ZONE}
networks:
Expand Down
5 changes: 3 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM nginx:1.20
ARG ARCH=amd64
FROM $ARCH/nginx:alpine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ARCH (we don't want to optimise for only one architecture, rather build an image which supports both, arm and amd).

And change image to nginx:1.25-alpine


ENV REMOTE_DATA=${REMOTE_DATA}

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
RUN apk update && apk add \
nano \
openssl \
gettext
Expand Down
2 changes: 1 addition & 1 deletion nginx/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# if there's no ssl certificate yet create it
if [ ! -f "/etc/nginx/ssl/domain.crt" ]
Expand Down
17 changes: 9 additions & 8 deletions php/php71/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:7.1-fpm-stretch
ARG ARCH=amd64
FROM $ARCH/php:7.1-fpm-buster

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -80,20 +81,20 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/8/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*

# Workaround to get MSSQL connection working on Debian 9 (stretch)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.6.1 \
Expand Down
18 changes: 9 additions & 9 deletions php/php72/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:7.2-fpm
ARG ARCH=amd64
FROM $ARCH/php:7.2-fpm

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -30,7 +31,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
graphviz \
aspell \
libldap2-dev \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) xmlrpc \
zip \
intl \
Expand Down Expand Up @@ -83,20 +83,20 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/8/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*

# Workaround to get MSSQL connection working on Debian 9 (stretch)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.8.1 \
Expand Down
18 changes: 9 additions & 9 deletions php/php73/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:7.3-fpm-buster
ARG ARCH=amd64
FROM $ARCH/php:7.3-fpm-buster

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -30,7 +31,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
graphviz \
aspell \
libldap2-dev \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) xmlrpc \
zip \
intl \
Expand Down Expand Up @@ -83,20 +83,20 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*

# Workaround to get MSSQL connection working on Debian 9 (stretch)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.9.0 \
Expand Down
18 changes: 9 additions & 9 deletions php/php74/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:7.4-fpm-buster
ARG ARCH=amd64
FROM $ARCH/php:7.4-fpm-buster

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -28,7 +29,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
graphviz \
aspell \
libldap2-dev \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) xmlrpc \
zip \
intl \
Expand Down Expand Up @@ -78,19 +78,19 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev

# Workaround to get MSSQL connection working on Debian 9 (stretch)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.10.0 \
Expand Down
18 changes: 9 additions & 9 deletions php/php80/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:8.0-fpm-buster
ARG ARCH=amd64
FROM $ARCH/php:8.0-fpm-buster

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -28,7 +29,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
graphviz \
aspell \
libldap2-dev \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) zip \
intl \
soap \
Expand Down Expand Up @@ -77,19 +77,19 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev

# Workaround to get MSSQL connection working on Debian 10 (buster)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.10.0 \
Expand Down
17 changes: 9 additions & 8 deletions php/php81/Dockerfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in the PHP Dockerfiles are obsolete, they have been updated to bullseye in #248.

Moving the PHP containers to alpine is possible I think but requires a bit more work. I have experimented with it locally and can add a followup patch at a later stage.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:8.1-fpm-buster
ARG ARCH=amd64
FROM $ARCH/php:8.1-fpm-buster

ARG TIME_ZONE=Pacific/Auckland

Expand Down Expand Up @@ -62,19 +63,19 @@ ENV LC_ALL en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql17 \
mssql-tools \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev

# Workaround to get MSSQL connection working on Debian 10 (buster)
# https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
&& DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
#RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb" \
# && DEBIAN_FRONTEND=noninteractive dpkg -i ./libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc

RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.10.0 \
Expand Down
Loading