-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
…machine
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Upload Web Artifacts | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'Environment to build for' | ||
required: true | ||
type: choice | ||
options: | ||
- staging | ||
- production | ||
default: 'staging' | ||
|
||
jobs: | ||
build: | ||
name: Build and Upload | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
environment: ${{ inputs.environment }} | ||
secrets: inherit | ||
|
||
upload: | ||
name: Upload Artifacts | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: web-dist | ||
path: apps/web/dist | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: web-dist | ||
path: apps/web/dist | ||
retention-days: 5 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
# Builder stage | ||
FROM node:20-alpine@sha256:b5b9467fe7b33aad47f1ec3f6e0646a658f85f05c18d4243024212a91f3b7554 AS builder | ||
|
||
WORKDIR /app | ||
|
||
RUN corepack enable | ||
|
||
ENV NODE_OPTIONS=--max_old_space_size=8192 | ||
ENV VITE_API_URL=http://localhost:5800 | ||
ENV VITE_COLLAB_URL=http://localhost:5801 | ||
|
||
COPY . . | ||
RUN pnpm install | ||
RUN pnpm build:web | ||
|
||
# Nginx stage | ||
FROM nginx:alpine | ||
|
||
# Install envsubst and bash for environment variable substitution | ||
RUN apk add --no-cache bash | ||
|
||
# Copy nginx configuration | ||
COPY deploy/docker/nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Copy built files from builder stage | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
# Copy static files | ||
WORKDIR /usr/share/nginx/html | ||
COPY ./dist . | ||
|
||
# Create config.js template | ||
RUN echo "window.ENV = { \ | ||
API_URL: '${API_URL:-http://localhost:5800}', \ | ||
COLLAB_URL: '${COLLAB_URL:-http://localhost:5801}' \ | ||
};" > config.template.js | ||
|
||
# Create entrypoint script | ||
RUN echo '#!/bin/bash\n\ | ||
envsubst < config.template.js > config.js\n\ | ||
exec nginx -g "daemon off;"' > /docker-entrypoint.sh | ||
|
||
RUN chmod +x /docker-entrypoint.sh | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
# Start Nginx | ||
CMD ["nginx", "-g", "daemon off;"] | ||
# Start Nginx with our entrypoint script | ||
ENTRYPOINT ["/docker-entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
window.ENV = { | ||
API_URL: '', | ||
COLLAB_URL: '' | ||
}; |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.