This commit is contained in:
parent
f37280c3f6
commit
dc3fd58c72
3 changed files with 62 additions and 0 deletions
25
.woodpecker/build-and-publish.yml
Normal file
25
.woodpecker/build-and-publish.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
steps:
|
||||
- name: build
|
||||
image: node:alpine
|
||||
commands:
|
||||
- npm install -g pnpm
|
||||
- pnpm install
|
||||
- pnpm build
|
||||
when:
|
||||
- event: push
|
||||
- event: pull_request
|
||||
|
||||
- name: container-build-and-publish
|
||||
image: docker
|
||||
commands:
|
||||
- docker login --username radical --password $PASSWORD git.gorb.app
|
||||
- docker buildx build --platform linux/amd64,linux/arm64 --rm --push -t git.gorb.app/gorb/frontend:main .
|
||||
environment:
|
||||
PASSWORD:
|
||||
from_secret: docker_password
|
||||
volumes:
|
||||
- /var/run/podman/podman.sock:/var/run/docker.sock
|
||||
when:
|
||||
- branch: main
|
||||
event: push
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM node:alpine
|
||||
|
||||
COPY ./.output /web
|
||||
|
||||
COPY entrypoint.sh /usr/bin/entrypoint.sh
|
||||
|
||||
RUN useradd --create-home --home-dir /web gorb
|
||||
|
||||
USER gorb
|
||||
|
||||
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
26
entrypoint.sh
Executable file
26
entrypoint.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -d "/web/logs" ]; then
|
||||
mkdir /web/logs
|
||||
fi
|
||||
|
||||
rotate_log() {
|
||||
LOGFILE="$1"
|
||||
BASENAME=$(basename "$LOGFILE" .log)
|
||||
DIRNAME=$(dirname "$LOGFILE")
|
||||
|
||||
if [ -f "$LOGFILE" ]; then
|
||||
# Find the next available number
|
||||
i=1
|
||||
while [ -f "$DIRNAME/${BASENAME}.${i}.log.gz" ]; do
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
gzip "$LOGFILE"
|
||||
mv "${LOGFILE}.gz" "$DIRNAME/${BASENAME}.${i}.log.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
rotate_log "/web/logs/frontend.log"
|
||||
|
||||
/usr/bin/node /web/server/index.mjs 2>&1 | tee /gorb/logs/frontend.log
|
Loading…
Add table
Add a link
Reference in a new issue