Skip to content

Commit a89f7c8

Browse files
authored
Update images to accept BASE_IMAGE build argument (#20)
* include BASE_IMAGE argument * adjust docker-compose .env file to include BASE_IMAGE * include gh-action to test standalone image
1 parent 9f464d6 commit a89f7c8

File tree

8 files changed

+125
-97
lines changed

8 files changed

+125
-97
lines changed

.github/workflows/docker-image.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,38 @@ name: Docker Image CI
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [ main, master ]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: [ main, master ]
88

99
jobs:
10-
11-
build:
10+
test:
1211
runs-on: ubuntu-latest
12+
1313
steps:
14-
- uses: actions/checkout@v3
15-
- name: Build the Docker image
16-
run: |
17-
docker build ./dockerfiles/dachs -f ./dockerfiles/dachs/Dockerfile -t gavodachs/dachs:$(date +%s)
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Build Docker image
18+
run: docker build -t dachs:test ./dockerfiles/dachs/
19+
20+
- name: Run Docker container
21+
run: docker run --name dachs_container -dt dachs:test
22+
23+
- name: Verify container is running
24+
run: docker ps | grep -q dachs_container
25+
26+
- name: Start dachs service
27+
run: docker exec dachs_container /dachs.sh start
28+
29+
- name: Copy download script to container
30+
run: docker cp data/download_arihip.sh dachs_container:/tmp/download.sh
31+
32+
- name: Download arihip data
33+
run: docker exec dachs_container /tmp/download.sh arihip /var/gavo/inputs
34+
35+
- name: Import arihip data
36+
run: docker exec dachs_container dachs imp -M 1000 arihip/q.rd
37+
38+
- name: Run all tests
39+
run: docker exec dachs_container dachs test ALL

dockerfiles/.env

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Local path for Dachs logs (persistence)
22
DACHS_LOGS_PATH="./tmp/logs"
33

4+
# Base image (Debian, in DockerHub)
5+
BASE_IMAGE="debian:trixie"
6+
47
# Dachs branch/repository version.
58
# Options are: stable, backports, beta.
6-
INSTALL_REPO=main
9+
INSTALL_REPO="main"
710

811
# PostgreSQL version to build containers
9-
PG_VERSION=15
12+
PG_VERSION="15"

dockerfiles/awstats/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM httpd:bullseye
1+
FROM httpd:2.4
22

33
RUN DEBIAN_FRONTEND='noninteractive' && \
44
apt-get update && \

dockerfiles/dachs/Dockerfile

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
FROM debian:bookworm
1+
ARG BASE_IMAGE="debian:stable"
2+
3+
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
4+
# Options are:
5+
# - "gavo/beta" (gavo/release + gavo/beta)
6+
# - "backports" (debian/backports)
7+
# - "main" (debian/main)
8+
# * Default is "main"
9+
ARG INSTALL_REPO="main"
10+
11+
# PostgreSQL version to install
12+
# * Default is "15"
13+
ARG PG_VERSION="15"
14+
15+
FROM $BASE_IMAGE
216

317
LABEL Description=DaCHS\ is\ a\ publishing\ infrastructure\ for\ the\ Virtual\ Observatory. \
4-
Reference=http://arxiv.org/abs/1408.5733
18+
Reference=http://arxiv.org/abs/1408.5733
519

620
# Everyday tools
721
RUN DEBIAN_FRONTEND='noninteractive' \
822
&& apt-get update \
923
&& apt-get install -y \
10-
curl \
11-
git \
12-
gnupg2 \
13-
locales \
14-
procps \
15-
sudo \
16-
vim \
17-
wget \
24+
curl \
25+
git \
26+
gnupg2 \
27+
locales \
28+
procps \
29+
sudo \
30+
vim \
31+
wget \
1832
&& apt-get clean
1933

20-
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
21-
# Options are:
22-
# - backports (debian/backports)
23-
# - gavo/beta (gavo/release + gavo/beta)
24-
# - main (debian/main)
25-
# * If not defined, default is 'main'
26-
ARG INSTALL_REPO="${INSTALL_REPO:-main}"
27-
2834
ENV _APT_SOURCES="/etc/apt/sources.list.d/gavo.list"
2935
COPY etc/apt_sources.list "$_APT_SOURCES"
3036

@@ -46,13 +52,13 @@ RUN curl https://vo.ari.uni-heidelberg.de/debian/gavo-archive-keyring.asc \
4652

4753
# If installing any version other than "main", backports is in there:
4854
RUN [ "$INSTALL_REPO" != "main" ] \
49-
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
50-
|| echo "NOT using debian/backports repo"
55+
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
56+
|| echo "NOT using debian/backports repo"
5157

5258
# If installing -- i.e, "beta" version -- uncomment gavo's release and beta repos
5359
RUN [ "$INSTALL_REPO" = "gavo/beta" -o "$INSTALL_REPO" = "latest" -o "$INSTALL_REPO" = "gavo" ] \
54-
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
55-
|| echo "NOT using gavo beta/release repos"
60+
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
61+
|| echo "NOT using gavo beta/release repos"
5662

5763
RUN echo "Using the following repositories:" && grep "deb" $_APT_SOURCES
5864

dockerfiles/dachs/Dockerfile.dachs_postgres

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
FROM debian:bookworm
1+
ARG BASE_IMAGE="debian:stable"
2+
3+
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
4+
# Options are:
5+
# - "gavo/beta" (gavo/release + gavo/beta)
6+
# - "backports" (debian/backports)
7+
# - "main" (debian/main)
8+
# * Default is "main"
9+
ARG INSTALL_REPO="main"
10+
11+
# PostgreSQL version to install
12+
# * Default is "15"
13+
ARG PG_VERSION="15"
14+
15+
FROM $BASE_IMAGE
216

317
LABEL Description=DaCHS\ is\ a\ publishing\ infrastructure\ for\ the\ Virtual\ Observatory. \
4-
Reference=http://arxiv.org/abs/1408.5733
18+
Reference=http://arxiv.org/abs/1408.5733
519

620
# Everyday tools
721
RUN DEBIAN_FRONTEND='noninteractive' \
822
&& apt-get update \
923
&& apt-get install -y \
10-
curl \
11-
git \
12-
gnupg2 \
13-
locales \
14-
procps \
15-
sudo \
16-
vim \
17-
wget \
24+
curl \
25+
git \
26+
gnupg2 \
27+
locales \
28+
procps \
29+
sudo \
30+
vim \
31+
wget \
1832
&& apt-get clean
1933

20-
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
21-
# Options are:
22-
# - backports (debian/backports)
23-
# - gavo/beta (gavo/release + gavo/beta)
24-
# - main (debian/main)
25-
# * If not defined, default is 'main'
26-
ARG INSTALL_REPO="${INSTALL_REPO:-main}"
2734

2835
ENV _APT_SOURCES="/etc/apt/sources.list.d/gavo.list"
2936
COPY etc/apt_sources.list "$_APT_SOURCES"
@@ -46,17 +53,16 @@ RUN curl https://vo.ari.uni-heidelberg.de/debian/gavo-archive-keyring.asc \
4653

4754
# If installing any version other than "main", backports is in there:
4855
RUN [ "$INSTALL_REPO" != "main" ] \
49-
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
50-
|| echo "NOT using debian/backports repo"
56+
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
57+
|| echo "NOT using debian/backports repo"
5158

5259
# If installing -- i.e, "beta" version -- uncomment gavo's release and beta repos
5360
RUN [ "$INSTALL_REPO" = "gavo/beta" -o "$INSTALL_REPO" = "latest" -o "$INSTALL_REPO" = "gavo" ] \
54-
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
55-
|| echo "NOT using gavo beta/release repos"
61+
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
62+
|| echo "NOT using gavo beta/release repos"
5663

5764
RUN echo "Using the following repositories:" && grep "deb" $_APT_SOURCES
5865

59-
ARG PG_VERSION=15
6066
ENV PG_VERSION=${PG_VERSION}
6167

6268
RUN DEBIAN_FRONTEND='noninteractive' && \
@@ -73,8 +79,8 @@ RUN PGFILE=/etc/postgresql/${PG_VERSION}/main/pg_hba.conf && \
7379
RUN PGDATA=/var/lib/postgresql/${PG_VERSION} \
7480
mkdir -p -m 777 /var/run/postgresql/${PG_VERSION}-main.pg_stat_tmp/ && \
7581
su - postgres -c "/usr/lib/postgresql/${PG_VERSION}/bin/postgres \
76-
-c config_file=/etc/postgresql/${PG_VERSION}/main/postgresql.conf \
77-
-c logging_collector=on" & \
82+
-c config_file=/etc/postgresql/${PG_VERSION}/main/postgresql.conf \
83+
-c logging_collector=on" & \
7884
sleep 5 && \
7985
su postgres -c "createuser -s dachsroot" && \
8086
su postgres -c "createuser -s root" && \

dockerfiles/dachs/Dockerfile.dachs_server

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
FROM debian:bookworm
1+
ARG BASE_IMAGE="debian:stable"
2+
3+
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
4+
# Options are:
5+
# - "gavo/beta" (gavo/release + gavo/beta)
6+
# - "backports" (debian/backports)
7+
# - "main" (debian/main)
8+
# * Default is "main"
9+
ARG INSTALL_REPO="main"
10+
11+
# PostgreSQL version to install
12+
# * Default is "15"
13+
ARG PG_VERSION="15"
14+
15+
FROM $BASE_IMAGE
216

317
LABEL Description=DaCHS\ is\ a\ publishing\ infrastructure\ for\ the\ Virtual\ Observatory. \
4-
Reference=http://arxiv.org/abs/1408.5733
18+
Reference=http://arxiv.org/abs/1408.5733
519

620
# Everyday tools
721
RUN DEBIAN_FRONTEND='noninteractive' \
822
&& apt-get update \
923
&& apt-get install -y \
10-
curl \
11-
git \
12-
gnupg2 \
13-
locales \
14-
procps \
15-
sudo \
16-
vim \
17-
wget \
24+
curl \
25+
git \
26+
gnupg2 \
27+
locales \
28+
procps \
29+
sudo \
30+
vim \
31+
wget \
1832
&& apt-get clean
1933

20-
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
21-
# Options are:
22-
# - backports (debian/backports)
23-
# - gavo/beta (gavo/release + gavo/beta)
24-
# - main (debian/main)
25-
# * If not defined, default is 'main'
26-
ARG INSTALL_REPO="${INSTALL_REPO:-main}"
27-
2834
ENV _APT_SOURCES="/etc/apt/sources.list.d/gavo.list"
2935
COPY etc/apt_sources.list "$_APT_SOURCES"
3036

@@ -46,13 +52,13 @@ RUN curl https://vo.ari.uni-heidelberg.de/debian/gavo-archive-keyring.asc \
4652

4753
# If installing any version other than "main", backports is in there:
4854
RUN [ "$INSTALL_REPO" != "main" ] \
49-
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
50-
|| echo "NOT using debian/backports repo"
55+
&& sed -i '/deb.*backports/s/^#//' $_APT_SOURCES \
56+
|| echo "NOT using debian/backports repo"
5157

5258
# If installing -- i.e, "beta" version -- uncomment gavo's release and beta repos
5359
RUN [ "$INSTALL_REPO" = "gavo/beta" -o "$INSTALL_REPO" = "latest" -o "$INSTALL_REPO" = "gavo" ] \
54-
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
55-
|| echo "NOT using gavo beta/release repos"
60+
&& sed -i '/deb.*heidelberg/s/^#//' $_APT_SOURCES \
61+
|| echo "NOT using gavo beta/release repos"
5662

5763
RUN echo "Using the following repositories:" && grep "deb" $_APT_SOURCES
5864

@@ -62,7 +68,6 @@ ENV GAVO_INPUTS="${GAVO_ROOT}/inputs"
6268
ENV GAVO_SETTINGS="/etc/gavo.rc"
6369
ENV GAVOSETTINGS="$GAVO_SETTINGS"
6470

65-
ARG PG_VERSION=13
6671
ENV PG_VERSION=${PG_VERSION}
6772

6873
# Install only the core of gavo and spatial extension to db

dockerfiles/docker-compose.full.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
build:
77
context: ./dachs
88
args:
9-
PG_VERSION: "${PG_VERSION:-15}"
9+
PG_VERSION: "${PG_VERSION}"
1010
image: dachs:postgres
1111
container_name: postgres
1212
tty: true
@@ -19,7 +19,7 @@ services:
1919
dockerfile: Dockerfile.dachs_server
2020
args:
2121
INSTALL_REPO: "${INSTALL_REPO}"
22-
PG_VERSION: "${PG_VERSION:-15}"
22+
PG_VERSION: "${PG_VERSION}"
2323
image: dachs:server
2424
container_name: dachs
2525
tty: true
@@ -32,18 +32,3 @@ services:
3232
- 8080:8080
3333
volumes:
3434
- "${DACHS_LOGS_PATH:-./tmp/logs}:/var/gavo/logs"
35-
36-
37-
# awstats:
38-
# container_name: awstats
39-
# image: dachs:awstats
40-
# depends_on:
41-
# - dachs
42-
# build:
43-
# context: ./awstats
44-
# tty: true
45-
# network_mode: 'bridge'
46-
# ports:
47-
# - 80:80
48-
# volumes:
49-
# - "${DACHS_LOGS_PATH:-./tmp/logs}:/var/gavo/logs:ro"

dockerfiles/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ services:
88
context: ./dachs
99
dockerfile: Dockerfile
1010
args:
11+
BASE_IMAGE: "${BASE_IMAGE}"
1112
INSTALL_REPO: "${INSTALL_REPO}"
1213

1314
container_name: dachs

0 commit comments

Comments
 (0)