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

[BACK-662] Use GitHub Container Registry #3

Draft
wants to merge 6 commits into
base: main
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
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tmp/*
log/*
db/*.sqlite3
.git
.github

.env
.env.*

/vendor/*
/test/*

*.DS_Store
.vscode/
*.swp
*~
*.md

run
build
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
open-pull-requests-limit: 5
schedule:
interval: "monthly"
reviewers:
- "apptweak/qawaii"
22 changes: 22 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Hadolint

on:
push:
branches:
- "main"
paths:
- "Dockerfile"
pull_request:
types: [opened, synchronize]
paths:
- "Dockerfile"

jobs:
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
ignore: DL3018
42 changes: 42 additions & 0 deletions .github/workflows/publish-docker-image.yml
Copy link
Author

Choose a reason for hiding this comment

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

No need for this GH action. We can use Concourse CI to build and publish to our GHCR

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build & Push Docker image

on:
push:
paths-ignore:
- "README.md"
branches:
- "main"
tags:
- "v*"

env:
REGISTRY: ghcr.io
USERNAME: apptweak
VERSION: stable
# Fullname of the repo in the style `owner/name`
# REF: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
PROJECT: ${{ github.repository }}

jobs:
build-stable:
runs-on: ubuntu-latest
steps:
- name: Checkout to branch
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the container to GitHub Container Registry using tag
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.VERSION }}
push: true
provenance: false
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
FROM alpine
FROM alpine:3.20
LABEL org.opencontainers.image.source https://github.com/apptweak/simple-proxy-rotator
RUN apk add --no-cache \
openssl \
curl \
bash \
git \
dumb-init \
openssl
dumb-init

# Make sure to use bash with pipefail in case something
# fails while being piped to another command in the docker-build
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

WORKDIR /app
ADD glider glider.conf entrypoint.sh ./
COPY glider glider.conf entrypoint.sh ./

EXPOSE 15000

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/glider", "-config", "/app/glider.conf"]
CMD ["/app/glider", "-config", "/app/glider.conf"]
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
REGISTRY_HOST=ghcr.io
USERNAME=apptweak
PROJECT=simple-proxy-rotator
VERSION := $(shell cat VERSION)
IMAGE_NAME=$(REGISTRY_HOST)/$(USERNAME)/$(PROJECT)
IMAGE=$(IMAGE_NAME):$(VERSION)

build:
docker build -f Dockerfile --platform "linux/x86_64" --tag "$(IMAGE)" --tag "$(IMAGE_NAME):stable" .
# read --local --silent --prompt "Docker account's password: " passwd
# echo "$passwd" | docker login --username apptweakci --password-stdin
# gh auth token | docker login --username apptweakci --password-stdin ${IMAGE}
docker push "$(IMAGE)"
docker push "$(IMAGE_NAME):stable"

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
Loading