Skip to content

Commit 2a33a8c

Browse files
committed
Create the dockerfle and git action command
1 parent 39824c5 commit 2a33a8c

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Docker image
2+
# To maastrichtu-library GitHub Container Registry
3+
# https://github.com/orgs/maastrichtu-library/packages
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
paths:
9+
- 'Dockerfile'
10+
- '.github/workflows/publish-docker.yml'
11+
schedule:
12+
- cron: '0 3 * * 1'
13+
# Monday at 3:00 GMT+1
14+
15+
env:
16+
IMAGE_PULLED: postgres:latest
17+
IMAGE_PUSHED: ghcr.io/maastrichtu-library/postgres:latest
18+
19+
jobs:
20+
publish-latest:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Log into GitHub Container Registry
27+
# TODO: Create a token with `read:packages` and `write:packages` scopes
28+
# And save it as an Actions secret CONTAINER_REGISTRY_GITHUB_TOKEN
29+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
30+
31+
- name: Pull image from DockerHub
32+
run: docker pull $IMAGE_PULLED
33+
34+
- name: Push image to GitHub Container Registry
35+
run: |
36+
docker tag $IMAGE_PULLED $IMAGE_PUSHED
37+
docker push $IMAGE_PUSHED
38+
39+
# - name: Build image
40+
# run: docker build . --file Dockerfile --tag $IMAGE_PUSHED

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM postgres:latest
2+
3+
LABEL org.opencontainers.image.source https://github.com/maastrichtu-library/postgres
4+
5+
# RUN apt-get update

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
# postgres
1+
# postgres
2+
**Postgres** image mirror from https://hub.docker.com/_/postgres
3+
4+
cf. Github repository: https://github.com/docker-library/docs/tree/master/postgres
5+
6+
Hosted on [GitHub Container Registry](https://github.com/MaastrichtU-Library/postgres) ([ghcr.io](https://ghcr.io)) to avoid DockerHub pull limitations, and easily deploy on clusters (such as Kubernetes).
7+
8+
9+
## Automatically updated
10+
11+
[![Publish Docker image](https://github.com/MaastrichtU-Library/postgres/workflows/Publish%20Docker%20image/badge.svg)](https://github.com/MaastrichtU-Library/postgres/actions)
12+
13+
# The image on [ghcr.io](https://ghcr.io) is automatically updated every week (Monday at 3:00 GMT+1) by a GitHub Actions workflow to match the `latest` tag of [cellprofiler](https://hub.docker.com/_/cellprofiler)
14+
15+
## Run
16+
17+
```bash
18+
docker run -it -v $(pwd):/root ghcr.io/maastrichtu-library/postgres:latest
19+
```
20+
21+
In the container:
22+
23+
* User, with `sudo` privileges: `root`
24+
* Workspace path: `/root`
25+
26+
Set entrypoint to `tail -f /dev/null` to keep it hanging as a service.
27+
28+
```bash
29+
docker run -it --entrypoint tail -v $(pwd):/root ghcr.io/maastrichtu-library/postgres:latest -f /dev/null
30+
```
31+
32+
## Build
33+
34+
Feel free to edit the `Dockerfile` to install additional packages in the image.
35+
36+
```bash
37+
docker build -t ghcr.io/maastrichtu-library/postgres:latest .
38+
```
39+
40+
## Push
41+
42+
```bash
43+
docker push ghcr.io/maastrichtu-library/postgres:latest
44+
```
45+

0 commit comments

Comments
 (0)