Fix combined dockerfile
Build releases / build-docker (., focus) (push) Failing after 10m26s Details
Build releases / build-docker (./frontend, ./frontend/Dockerfile, focus-frontend) (push) Failing after 7m32s Details
Build releases / build-tauri (push) Failing after 27m44s Details
Build releases / build-server (push) Failing after 4m22s Details
Build releases / build-docker (./backend, focus-backend) (push) Failing after 10m32s Details

This commit is contained in:
Brieuc Dubois 2024-01-26 16:16:48 +01:00
parent baf3474c29
commit 7ab1c0b9d1
5 changed files with 28 additions and 20 deletions

View File

@ -1,33 +1,41 @@
#Frontend
FROM node:20 as frontend-builder
WORKDIR /app
COPY frontend/. .
COPY frontend/package.json .
COPY frontend/package-lock.json .
RUN npm install
COPY frontend .
RUN npm run build
# Backend
FROM golang:1.21.5 as backend-builder
WORKDIR /app
COPY backend/. .
RUN CGO_ENABLED=1 GOOS=linux go build -o main
# Combined
FROM debian:stable-slim
WORKDIR /app
COPY --from=frontend-builder /app /app/frontend
RUN apt-get update && \
apt-get install -y nginx
COPY --from=frontend-builder /app/build /var/www/html
COPY --from=backend-builder /app/main /app/backend/main
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs
VOLUME /data
EXPOSE 4173 3000
ENV DB_PATH=/data/db.sqlite
ENV PUBLIC_BACKEND_URL=http://localhost:3000
COPY run.sh /app/run.sh
RUN chmod +x /app/run.sh
VOLUME /data
EXPOSE 80 3000
ENV DB_PATH=/data/db.sqlite
ENV PUBLIC_BACKEND_URL=http://localhost:3000
CMD ["/app/run.sh"]

View File

@ -2,7 +2,7 @@ PUBLIC_BACKEND_URL=${PUBLIC_BACKEND_URL:-http://localhost:3000}
PUBLIC_BACKEND_WSURL=${PUBLIC_BACKEND_WSURL:-${PUBLIC_BACKEND_URL/http:/ws:}}
PUBLIC_BACKEND_WSURL=${PUBLIC_BACKEND_WSURL/https:/wss:}
find /usr/share/nginx/html -type f -exec sed -i "s|http://localhost:3000|$PUBLIC_BACKEND_URL|g" {} +
find /usr/share/nginx/html -type f -exec sed -i "s|ws://localhost:3000|$PUBLIC_BACKEND_WSURL|g" {} +
find /var/www/html -type f -exec sed -i "s|http://localhost:3000|$PUBLIC_BACKEND_URL|g" {} +
find /var/www/html -type f -exec sed -i "s|ws://localhost:3000|$PUBLIC_BACKEND_WSURL|g" {} +
nginx -g 'daemon off;'

View File

@ -9,7 +9,7 @@
},
"package": {
"productName": "Focus-Desktop",
"version": "0.4.0"
"version": "0.4.1"
},
"tauri": {
"allowlist": {

View File

@ -46,7 +46,7 @@
<div id="branding">
<a href="/">
<span id="title">Focus.</span>
<span id="version">v0.4.0</span>
<span id="version">v0.4.1</span>
</a>
</div>
<div id="views">

6
run.sh
View File

@ -4,10 +4,10 @@ PUBLIC_BACKEND_URL=${PUBLIC_BACKEND_URL:-http://localhost:3000}
PUBLIC_BACKEND_WSURL=${PUBLIC_BACKEND_WSURL:-${PUBLIC_BACKEND_URL/http:/ws:}}
PUBLIC_BACKEND_WSURL=${PUBLIC_BACKEND_WSURL/https:/wss:}
find frontend -type f -exec sed -i "s|http://localhost:3000|$PUBLIC_BACKEND_URL|g" {} +
find frontend -type f -exec sed -i "s|ws://localhost:3000|$PUBLIC_BACKEND_WSURL|g" {} +
find /usr/share/nginx/html -type f -exec sed -i "s|http://localhost:3000|$PUBLIC_BACKEND_URL|g" {} +
find /usr/share/nginx/html -type f -exec sed -i "s|ws://localhost:3000|$PUBLIC_BACKEND_WSURL|g" {} +
cd frontend && npm run preview -- --port 4173 --host 0.0.0.0 &
nginx -g 'daemon off;' &
cd backend && ./main &
wait -n