fix (ci): github action setup

This commit is contained in:
Mickael Kerjean 2023-03-14 20:15:21 +11:00
parent a450238129
commit 1f76916840
2 changed files with 42 additions and 10 deletions

View file

@ -35,7 +35,7 @@ jobs:
path: server/ctrl/static/www/ path: server/ctrl/static/www/
- uses: actions/setup-go@v3.5.0 - uses: actions/setup-go@v3.5.0
with: with:
go-version: 1.20 go-version: 1.19
- name: Setup - name: Setup
run: | run: |
mkdir -p ./dist/data/state/config mkdir -p ./dist/data/state/config
@ -99,7 +99,7 @@ jobs:
name: test name: test
- uses: actions/setup-go@v3.5.0 - uses: actions/setup-go@v3.5.0
with: with:
go-version: 1.20 go-version: 1.19
- name: Setup - name: Setup
run: | run: |
sudo apt-get install -y poppler-utils sudo apt-get install -y poppler-utils
@ -125,6 +125,9 @@ jobs:
run: | run: |
chmod +x filestash chmod +x filestash
timeout 5 ./filestash > access.log || code=$?; if [[ $code -ne 124 ]]; then exit $code; fi timeout 5 ./filestash > access.log || code=$?; if [[ $code -ne 124 ]]; then exit $code; fi
echo "========= access.log "
cat access.log
echo "====================="
cat access.log | grep -q "Filestash v0.5 starting" cat access.log | grep -q "Filestash v0.5 starting"
cat access.log | grep -q "listening on :" cat access.log | grep -q "listening on :"
cat access.log | grep -vz "WARN" cat access.log | grep -vz "WARN"
@ -177,10 +180,10 @@ jobs:
run: | run: |
export COMMIT_SHA=`git rev-parse --short HEAD` export COMMIT_SHA=`git rev-parse --short HEAD`
cd docker cd docker
docker build --tag machines/tmp:latest . docker build --tag machines/filestash:latest .
docker tag machines/tmp:latest machines/tmp:$COMMIT_SHA docker tag machines/filestash:latest machines/filestash:$COMMIT_SHA
docker push machines/tmp:latest docker push machines/filestash:latest
docker push machines/tmp:$COMMIT_SHA docker push machines/filestash:$COMMIT_SHA
deploy: deploy:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'

View file

@ -13,13 +13,12 @@ RUN apk add make git && \
make build_frontend make build_frontend
# STEP3: BUILD THE BACKEND # STEP3: BUILD THE BACKEND
FROM golang:1.20-stretch AS builder_backend FROM golang:1.19-buster AS builder_backend
WORKDIR /home/ WORKDIR /home/
COPY --from=builder_frontend /home/ ./ COPY --from=builder_frontend /home/ ./
RUN apt-get update > /dev/null && \ RUN apt-get update > /dev/null && \
apt-get install -y libvips-dev curl make > /dev/null 2>&1 && \ apt-get install -y libvips-dev curl make > /dev/null 2>&1 && \
go mod tidy && go mod vendor && \ make build_init && \
go generate -x ./server/... && \
make build_backend && \ make build_backend && \
mkdir -p ./dist/data/state/config/ && \ mkdir -p ./dist/data/state/config/ && \
cp config/config.json ./dist/data/state/config/config.json cp config/config.json ./dist/data/state/config/config.json
@ -31,7 +30,37 @@ COPY --from=builder_backend /home/dist/ /app/
WORKDIR "/app" WORKDIR "/app"
RUN apt-get update > /dev/null && \ RUN apt-get update > /dev/null && \
apt-get install -y --no-install-recommends apt-utils && \ apt-get install -y --no-install-recommends apt-utils && \
apt-get install -y emacs-nox ffmpeg zip poppler-utils > /dev/null apt-get install -y curl emacs-nox ffmpeg zip poppler-utils > /dev/null && \
# org-mode: html export
curl https://raw.githubusercontent.com/mickael-kerjean/filestash/master/server/.assets/emacs/htmlize.el > /usr/share/emacs/site-lisp/htmlize.el && \
# org-mode: markdown export
curl https://raw.githubusercontent.com/mickael-kerjean/filestash/master/server/.assets/emacs/ox-gfm.el > /usr/share/emacs/site-lisp/ox-gfm.el && \
# org-mode: pdf export (with a light latex distribution)
cd && apt-get install -y wget perl > /dev/null && \
export CTAN_REPO="http://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet" && \
curl -sL "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh && \
mv ~/.TinyTeX /usr/share/tinytex && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wasy && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install ulem && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install marvosym && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wasysym && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install xcolor && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install listings && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install parskip && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install float && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wrapfig && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install sectsty && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install capt-of && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install epstopdf-pkg && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install cm-super && \
ln -s /usr/share/tinytex/bin/x86_64-linux/pdflatex /usr/local/bin/pdflatex && \
apt-get purge -y --auto-remove perl wget && \
# Cleanup
find /usr/share/ -name 'doc' | xargs rm -rf && \
find /usr/share/emacs -name '*.pbm' | xargs rm -f && \
find /usr/share/emacs -name '*.png' | xargs rm -f && \
find /usr/share/emacs -name '*.xpm' | xargs rm -f
RUN useradd filestash && \ RUN useradd filestash && \
chown -R filestash:filestash /app/ && \ chown -R filestash:filestash /app/ && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \