This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
create | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@master | ||
with: | ||
platforms: arm64,amd64 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ secrets.DOCKER_NAMESPACE }}/${{ secrets.DOCKER_REPOSITORY }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY . /app/oci-arm-host-capacity | ||
|
||
RUN apt update && apt install -y git php-cli php-curl php-xml jq nano unzip curl && \ | ||
mkdir /compose && \ | ||
useradd -r -s /bin/false ubuntu; \ | ||
groupadd docker; \ | ||
usermod -aG docker ubuntu; \ | ||
cd /compose && \ | ||
curl -sS https://getcomposer.org/installer -o composer-setup.php && \ | ||
HASH=`curl -sS https://composer.github.io/installer.sig` && \ | ||
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \ | ||
php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ | ||
cd /app/oci-arm-host-capacity && \ | ||
composer update && \ | ||
composer install && \ | ||
chown ubuntu:ubuntu /app/oci-arm-host-capacity | ||
|
||
WORKDIR /app/oci-arm-host-capacity | ||
|
||
USER ubuntu | ||
|
||
COPY run.sh run.sh | ||
CMD ./run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY . /app/oci-arm-host-capacity | ||
|
||
# first build to generate this layer | ||
RUN apt update && apt install -y git php-cli php-curl php-xml jq nano unzip curl && \ | ||
mkdir /compose && \ | ||
useradd -r -s /bin/false ubuntu; \ | ||
groupadd docker; \ | ||
usermod -aG docker ubuntu; | ||
|
||
# SECOND build to generate this layer, uncomment after first build and build again | ||
# RUN cd /compose && \ | ||
# curl -sS https://getcomposer.org/installer -o composer-setup.php && \ | ||
# HASH=`curl -sS https://composer.github.io/installer.sig` && \ | ||
# php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \ | ||
# php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ | ||
# mkdir /app | ||
|
||
# THIRT build to generate this layer, uncommnet after second build and build again | ||
# RUN cd /app/oci-arm-host-capacity && \ | ||
# composer update && \ | ||
# composer install && \ | ||
# chown ubuntu:ubuntu /app/oci-arm-host-capacity | ||
|
||
WORKDIR /app/oci-arm-host-capacity | ||
|
||
USER ubuntu | ||
|
||
COPY run.sh run.sh | ||
CMD ./run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# oracle-tf | ||
### [source and config](https://github.com/hitrov/oci-arm-host-capacity) | ||
|
||
* build Dockerfile | ||
* $ docker login | ||
* $ docker buildx build --platform linux/arm64,linux/amd64 -t DOCKER/IMAGENAME:IMAGETAG -o type=registry . | ||
|
||
|
||
* Build local whith DockerfilePerformance, edit DockerfilePerformance to first image | ||
* $ docker login | ||
* Fisrt and Second___: docker buildx build --platform linux/arm64,linux/amd64 -f DockerfilePerformance -t DOCKER/IMAGENAME:IMAGETAG -o type=image . | ||
* Thirt______________: docker buildx build --platform linux/arm64,linux/amd64 -f DockerfilePerformance -t DOCKER/IMAGENAME:IMAGETAG -o type=registry . | ||
|
||
* run | ||
* $ docker create --name machine DOCKER/IMAGENAME:IMAGETAG | ||
* $ docker cp your-private-file.pem machine:/app/oci-arm-host-capacity | ||
* $ docker cp .env machine:/app/oci-arm-host-capacity | ||
* $ docker start machine | ||
|
||
|
||
* Github action - .github/workflows/docker-image.yml | ||
* add secret - github.com > project > settings > Secrets > Actions | ||
* DOCKER_NAMESPACE | ||
* DOCKER_PASSWORD | ||
* create a token on user settings | ||
* DOCKER_REPOSITORY | ||
* DOCKER_USERNAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
CODE=$(php ./index.php | jq -r '.code'); | ||
|
||
|
||
while [ "$CODE" != "LimitExceeded" ] | ||
do | ||
REQ=$(php ./index.php); | ||
|
||
CODE=$(echo "${REQ}"| jq -r '.code') | ||
MSG=$(echo "${REQ}"| jq -r '.message') | ||
|
||
echo $(date +%F_%H-%M-%S) - $CODE - $MSG; | ||
sleep 10m; | ||
done |