Skip to content

Commit

Permalink
feat: it-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
joryirving committed Oct 11, 2024
1 parent e035624 commit ae9f6b1
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
47 changes: 47 additions & 0 deletions apps/it-tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
ARG VERSION
FROM node:lts-alpine AS build

ARG VERSION
ARG FULLVERSION
ARG CHANNEL
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETOS

LABEL dev.joryirving.image.target_platform=$TARGETPLATFORM
LABEL dev.joryirving.image.target_architecture=$TARGETARCH
LABEL dev.joryirving.image.target_os=$TARGETOS
LABEL org.opencontainers.image.source="https://github.com/CorentinTh/it-tools"

RUN \
apk add --no-cache curl git \
&& git clone https://github.com/CorentinTh/it-tools.git /app \
&& cd /app \
&& git checkout $FULLVERSION

WORKDIR /app

RUN \
corepack enable \
&& corepack prepare pnpm@latest --activate \
&& pnpm install --prefer-offline \
&& pnpm build

FROM nginxinc/nginx-unprivileged:alpine

USER root
RUN \
apk add --no-cache \
catatonit

USER nginx

COPY --chown=101:101 --from=build /app/dist/ /usr/share/nginx/html/
COPY --chown=101:101 --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./entrypoint.sh /entrypoint.sh

RUN \
sed -i "s/worker_processes auto;/worker_processes 2;/g" /etc/nginx/nginx.conf \
&& sed -i "s/80;/8080;/g" /etc/nginx/conf.d/default.conf

ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]
13 changes: 13 additions & 0 deletions apps/it-tools/ci/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/goss-org/goss/master/docs/schema.yaml
process:
nginx:
running: true

port:
tcp:8080:
listening: true

http:
http://localhost:8080:
status: 200
8 changes: 8 additions & 0 deletions apps/it-tools/ci/latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
version="$(curl -sX GET "https://api.github.com/repos/CorentinTh/it-tools/releases/latest" | jq --raw-output '.tag_name' || true)"
version="${version#*v}"
version="${version#*release-}"
fullversion="${version#*release-}"
version="${version%%-*}"
printf "%s" "${version}"
printf "%s" "${fullversion}"
12 changes: 12 additions & 0 deletions apps/it-tools/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
#shellcheck disable=SC2086

if [ -n "${HTTP_WORKERS}" ]; then
sed -i "s/worker_processes 2;/worker_processes ${HTTP_WORKERS};/g" /etc/nginx/nginx.conf
fi

if [ -n "${HTTP_PORT}" ]; then
sed -i "s/8080;/${HTTP_PORT};/g" /etc/nginx/conf.d/default.conf
fi

nginx -g "daemon off;"
10 changes: 10 additions & 0 deletions apps/it-tools/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
app: it-tools
semver: true
channels:
- name: stable
platforms: ["linux/amd64", "linux/arm64"]
stable: true
tests:
enabled: true
type: web

0 comments on commit ae9f6b1

Please sign in to comment.