add gitea actions
This commit is contained in:
parent
1664e36504
commit
cbf48d7b3e
|
@ -1,4 +1,5 @@
|
|||
Justfile
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
LICENSE
|
||||
LICENSE
|
||||
.gitea
|
||||
.git
|
|
@ -0,0 +1,90 @@
|
|||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*[0-9].*[0-9].*[0-9]?(-rc?(.*[0-9])|-dev?(.*[0-9]))"
|
||||
- latest
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# services:
|
||||
# docker:
|
||||
# image: docker:dind
|
||||
# env:
|
||||
# DOCKER_TLS_CERTDIR: /certs
|
||||
# options: --privileged
|
||||
# volumes:
|
||||
# - /certs/ca:/certs/ca
|
||||
# - /certs/client:/certs/client
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
runs-on: ubuntu-latest
|
||||
container: docker:latest
|
||||
# env:
|
||||
# DOCKER_TLS_CERTDIR: /certs
|
||||
steps:
|
||||
- name: Set up NodeJS
|
||||
run: |
|
||||
apk update
|
||||
apk add nodejs npm
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitea.antoine-langlois.net
|
||||
username: ${{ gitea.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Get latest version
|
||||
id: get_lts
|
||||
if: ${{ gitea.ref_name == 'latest' }}
|
||||
run: |
|
||||
apk add jq curl
|
||||
echo "version=$(curl -sfL https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | jq .tag_name)" >> $GITEA_OUTPUT
|
||||
|
||||
- name: Checkout
|
||||
# todo: uncomment when checkout support other git servers
|
||||
# uses: actions/checkout@v3
|
||||
run: |
|
||||
apk add git
|
||||
git clone --depth 1 --branch ${{ gitea.ref_name }} https://gitea.antoine-langlois.net/${{ gitea.repository }}.git .
|
||||
|
||||
- name: Build and push latest
|
||||
uses: docker/build-push-action@v4
|
||||
if: ${{ gitea.ref_name == 'latest' }}
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.get_lts.outputs.version }}
|
||||
push: true
|
||||
tags:
|
||||
datahearth/reactive-resume:${{ steps.get_lts.outputs.version }}
|
||||
datahearth/reactive-resume:latest
|
||||
gitea.antoine-langlois.net/reactive-resume:${{ steps.get_lts.outputs.version }}
|
||||
gitea.antoine-langlois.net/reactive-resume:latest
|
||||
|
||||
- name: Build and push tag
|
||||
uses: docker/build-push-action@v4
|
||||
if: ${{ gitea.ref_name != 'latest' }}
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ gitea.ref_name }}
|
||||
push: true
|
||||
tags: |
|
||||
datahearth/reactive-resume:${{ gitea.ref_name }
|
||||
gitea.antoine-langlois.net/reactive-resume:${{ gitea.ref_name }}
|
21
Dockerfile
21
Dockerfile
|
@ -2,22 +2,25 @@ FROM node:lts-bullseye-slim
|
|||
|
||||
ARG VERSION
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y git
|
||||
|
||||
RUN git clone --depth 1 --branch ${VERSION} https://github.com/AmruthPillai/Reactive-Resume.git app
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y git
|
||||
|
||||
RUN npm install -g pnpm pm2
|
||||
|
||||
RUN git clone --depth 1 --branch ${VERSION} https://github.com/AmruthPillai/Reactive-Resume.git /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm build
|
||||
|
||||
COPY . .
|
||||
COPY .env /data/.env.template
|
||||
COPY entrypoint.sh /data/entrypoint.sh
|
||||
COPY ecosystem.config.js /data/ecosystem.config.js
|
||||
|
||||
RUN cp .env /tmp/.env
|
||||
RUN mv entrypoint.sh /usr/bin/entrypoint.sh && chmod a+x /usr/bin/entrypoint.sh
|
||||
RUN chmod a+x /data/entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]
|
||||
CMD [ "pm2-runtime", "ecosystem.config.js" ]
|
||||
ENTRYPOINT [ "/data/entrypoint.sh" ]
|
||||
CMD [ "pm2-runtime", "/data/ecosystem.config.js" ]
|
27
Justfile
27
Justfile
|
@ -1,27 +0,0 @@
|
|||
default: build-latest
|
||||
|
||||
LATEST_VERSION := `xh https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest Accept:application/vnd.github+json X-GitHub-Api-Version:2022-11-28 | jq .tag_name`
|
||||
|
||||
# build and push latest version of reactive-resume to "gitea" and "docker"
|
||||
build-latest:
|
||||
@echo "building images..."
|
||||
docker build -t gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} --build-arg VERSION={{LATEST_VERSION}} .
|
||||
docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} gitea.antoine-langlois.net/datahearth/reactive-resume:latest
|
||||
docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} datahearth/reactive-resume:{{LATEST_VERSION}}
|
||||
docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} datahearth/reactive-resume:latest
|
||||
|
||||
@echo "pushing images..."
|
||||
docker push gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}}
|
||||
docker push gitea.antoine-langlois.net/datahearth/reactive-resume:latest
|
||||
docker push datahearth/reactive-resume:{{LATEST_VERSION}}
|
||||
docker push datahearth/reactive-resume:latest
|
||||
|
||||
# build and push specific version of reactive-resume to "gitea" and "docker"
|
||||
build VERSION:
|
||||
@echo "building images..."
|
||||
docker build -t gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}} --build-arg VERSION={{VERSION}} .
|
||||
docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}} datahearth/reactive-resume:{{VERSION}}
|
||||
|
||||
@echo "pushing images..."
|
||||
docker push gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}}
|
||||
docker push datahearth/reactive-resume:{{VERSION}}
|
|
@ -1,11 +1,11 @@
|
|||
module.exports = [
|
||||
{
|
||||
script: "pnpm start --filter server",
|
||||
script: "pnpm --filter server start",
|
||||
cwd: "/app",
|
||||
name: "server",
|
||||
},
|
||||
{
|
||||
script: "pnpm start --filter client",
|
||||
script: "pnpm --filter client start",
|
||||
cwd: "/app",
|
||||
name: "client",
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
cp /tmp/.env .
|
||||
cp /data/.env.template .env
|
||||
fi
|
||||
|
||||
set -a
|
||||
|
|
Reference in New Issue