Fixed some auth stuff and deployment stuff #7
							
								
								
									
										17
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -47,6 +47,9 @@ FROM rust:alpine AS backend-builder | |||||||
| WORKDIR /app | WORKDIR /app | ||||||
| RUN apk add --no-cache musl-dev pkgconfig openssl-dev openssl-libs-static | RUN apk add --no-cache musl-dev pkgconfig openssl-dev openssl-libs-static | ||||||
|  |  | ||||||
|  | # Install sqlx-cli for migrations | ||||||
|  | RUN cargo install sqlx-cli --no-default-features --features sqlite | ||||||
|  |  | ||||||
| # Copy shared models | # Copy shared models | ||||||
| COPY calendar-models ./calendar-models | COPY calendar-models ./calendar-models | ||||||
|  |  | ||||||
| @@ -81,13 +84,23 @@ RUN apk add --no-cache ca-certificates tzdata | |||||||
| # Copy frontend files to temporary location | # Copy frontend files to temporary location | ||||||
| COPY --from=builder /app/frontend/dist /app/frontend-dist | COPY --from=builder /app/frontend/dist /app/frontend-dist | ||||||
|  |  | ||||||
| # Copy backend binary (built in workspace root) | # Copy backend binary and sqlx-cli | ||||||
| COPY --from=backend-builder /app/target/release/backend /usr/local/bin/backend | COPY --from=backend-builder /app/target/release/backend /usr/local/bin/backend | ||||||
|  | COPY --from=backend-builder /usr/local/cargo/bin/sqlx /usr/local/bin/sqlx | ||||||
|  |  | ||||||
| # Create startup script to copy frontend files to shared volume | # Copy migrations for database setup | ||||||
|  | COPY --from=backend-builder /app/backend/migrations /migrations | ||||||
|  |  | ||||||
|  | # Copy existing database if it exists (optional - migrations will create if needed) | ||||||
|  | COPY --from=backend-builder /app/backend/calendar.db /calendar.db 2>/dev/null || true | ||||||
|  |  | ||||||
|  | # Create startup script to copy frontend files, run migrations, and start backend | ||||||
| RUN mkdir -p /srv/www | RUN mkdir -p /srv/www | ||||||
| RUN echo '#!/bin/sh' > /usr/local/bin/start.sh && \ | RUN echo '#!/bin/sh' > /usr/local/bin/start.sh && \ | ||||||
|  |     echo 'echo "Copying frontend files..."' >> /usr/local/bin/start.sh && \ | ||||||
|     echo 'cp -r /app/frontend-dist/* /srv/www/' >> /usr/local/bin/start.sh && \ |     echo 'cp -r /app/frontend-dist/* /srv/www/' >> /usr/local/bin/start.sh && \ | ||||||
|  |     echo 'echo "Running database migrations..."' >> /usr/local/bin/start.sh && \ | ||||||
|  |     echo 'sqlx migrate run --database-url "sqlite:/calendar.db" --source /migrations || echo "Migration failed but continuing..."' >> /usr/local/bin/start.sh && \ | ||||||
|     echo 'echo "Starting backend server..."' >> /usr/local/bin/start.sh && \ |     echo 'echo "Starting backend server..."' >> /usr/local/bin/start.sh && \ | ||||||
|     echo '/usr/local/bin/backend' >> /usr/local/bin/start.sh && \ |     echo '/usr/local/bin/backend' >> /usr/local/bin/start.sh && \ | ||||||
|     chmod +x /usr/local/bin/start.sh |     chmod +x /usr/local/bin/start.sh | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user