Skip to content

Commit 5910464

Browse files
committed
feat: postgres
1 parent 17b4547 commit 5910464

11 files changed

+72
-33
lines changed

.github/workflows/postgres.yml

+21-19
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,30 @@ on:
66
- "postgres/**"
77

88
env:
9-
POSTGRES_VERSION: 12.3-2
10-
DOCKER_TAG: 12.3
9+
IMAGE: postgres
10+
VERSION: 12.3
11+
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
12+
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
1113

1214
jobs:
1315
build:
14-
runs-on: windows-latest
15-
defaults:
16-
run:
17-
shell: bash
16+
runs-on: ${{ matrix.os }}
17+
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, windows-latest]
21+
1822
steps:
1923
- uses: actions/checkout@v1
20-
- name: build
21-
run: |
22-
cd postgres
23-
docker build --build-arg VERSION=$POSTGRES_VERSION --file Dockerfile.windows --tag exivity/postgres:$DOCKER_TAG .
24-
docker tag exivity/postgres:$DOCKER_TAG exivity/postgres:latest
25-
- name: login
26-
run: echo $DOCKER_HUB_TOKEN | docker login -u $DOCKER_HUB_USER --password-stdin
24+
- run: bash build.sh
2725
env:
28-
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
29-
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
30-
- name: push
31-
run: |
32-
docker push exivity/postgres:$DOCKER_TAG
33-
docker push exivity/postgres:latest
26+
CI_PLATFORM: ${{ matrix.os }}
27+
EXTRA_BUILD_ARG: 12.3-2
28+
29+
manifest:
30+
needs: build
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v1
35+
- run: bash manifest.sh

base/Dockerfile.windows

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# escape=`
2+
3+
ARG PS_VERSION=7.0.3
4+
ARG NODE_VERSION=12.18.3
5+
ARG YARN_VERSION=1.22.4
6+
ARG GIT_VERSION=2.28.0
7+
28
ARG SOURCE=mcr.microsoft.com/windows/servercore:ltsc2019
39
ARG TARGET=$SOURCE
410

511
# Use server core as an installer container
612
# As this is a multi-stage build, this stage will eventually be thrown away
713
FROM $SOURCE AS installer-env
814

9-
# Set versions
10-
ARG PS_VERSION=7.0.3
11-
ARG NODE_VERSION=12.18.3
12-
ARG YARN_VERSION=1.22.4
13-
ARG GIT_VERSION=2.28.0
14-
1515
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
1616

1717
# Install PowerShell

base/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# exivity/base
22

3-
Multiarch Docker base image (Windows and Linux).
3+
Docker base image
44

55
## Usage
66

@@ -30,3 +30,6 @@ Base image: _ubuntu:latest_
3030

3131
- zip
3232
- unzip
33+
- git
34+
- nodejs 12
35+
- yarn 1

build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LATEST_TAG=latest-$PLATFORM
1414

1515
docker build \
1616
--build-arg VERSION=$VERSION \
17+
--build-arg EXTRA_BUILD_ARG=$EXTRA_BUILD_ARG \
1718
--file $DOCKERFILE \
1819
--tag exivity/$IMAGE:$VERSION_TAG \
1920
.

postgres/Dockerfile.linux

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG VERSION
2+
3+
FROM postgres:$VERSION
4+
5+
COPY healthcheck.sh /usr/local/bin/
6+
7+
HEALTHCHECK CMD ["healthcheck.sh"]

postgres/Dockerfile.windows

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS download
33

44
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
55

6-
ARG VERSION
6+
ARG EXTRA_BUILD_ARG
77

8-
RUN Invoke-WebRequest $('https://get.enterprisedb.com/postgresql/postgresql-{0}-windows-x64-binaries.zip' -f $env:VERSION) -OutFile 'postgres.zip' -UseBasicParsing ; \
8+
RUN Invoke-WebRequest $('https://get.enterprisedb.com/postgresql/postgresql-{0}-windows-x64-binaries.zip' -f $env:EXTRA_BUILD_ARG) -OutFile 'postgres.zip' -UseBasicParsing ; \
99
Expand-Archive postgres.zip -DestinationPath C:\ ; \
1010
Remove-Item postgres.zip
1111

postgres/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# exivity/postgres
22

3-
Docker image of PostgreSQL server (Windows only).
3+
Docker image of PostgreSQL server
44

55
## Usage
66

postgres/healthcheck.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# https://github.com/docker-library/healthcheck/blob/master/postgres/docker-healthcheck
4+
5+
set -eo pipefail
6+
7+
host="$(hostname -i || echo '127.0.0.1')"
8+
user="${POSTGRES_USER:-postgres}"
9+
db="${POSTGRES_DB:-$POSTGRES_USER}"
10+
export PGPASSWORD="${POSTGRES_PASSWORD:-}"
11+
12+
args=(
13+
# force postgres to not use the local unix socket (test "external" connectibility)
14+
--host "$host"
15+
--username "$user"
16+
--dbname "$db"
17+
--quiet --no-align --tuples-only
18+
)
19+
20+
if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then
21+
exit 0
22+
fi
23+
24+
exit 1

rabbitmq/Dockerfile.linux

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM rabbitmq
1+
ARG VERSION
2+
3+
FROM rabbitmq:$VERSION-management
24

35
COPY healthcheck.sh /usr/local/bin/
46

rabbitmq/Dockerfile.windows

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM mcr.microsoft.com/windows/servercore:ltsc2019
2-
31
ARG VERSION
42

3+
FROM mcr.microsoft.com/windows/servercore:ltsc2019
4+
55
USER ContainerAdministrator
66

77
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

rabbitmq/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# exivity/rabbitmq
22

3-
Docker image of Rabbit MQ server.
3+
Docker image of Rabbit MQ server
44

55
## Usage
66

0 commit comments

Comments
 (0)