Skip to content

Commit

Permalink
🚀 Deployment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Wakeful-Cloud committed Apr 14, 2024
1 parent ac7a869 commit b9777ef
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:
id: docker_metadata
uses: docker/metadata-action@v5
with:
flavor: latest=true
images: ghcr.io/ColoradoSchoolOfMines/beacon
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
Expand Down
2 changes: 1 addition & 1 deletion deployment/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# Single Page Application (https://caddyserver.com/docs/caddyfile/patterns#single-page-apps-spas)
handle {
root * /host/dist
root * /usr/share/caddy
encode gzip
try_files {path} /index.html
templates /runtime-vars.js {
Expand Down
19 changes: 7 additions & 12 deletions deployment/frontend.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM node:20.12.2-alpine3.18@sha256:d328c7bc3305e1ab26491817936c8151a47a8861ad61
RUN apk add --no-cache git

# Set working directory
WORKDIR /app
WORKDIR /dev

# Copy source code
COPY . .
Expand All @@ -24,25 +24,20 @@ FROM caddy:2.7.6-alpine@sha256:95ce04978787e23e35143d23b8af2fbb6d6de55213b54a2e9
# Install packages
RUN apk add --no-cache wget

# Add labels
LABEL org.opencontainers.image.source=https://github.com/ColoradoSchoolOfMines/beacon

# Set working directory
WORKDIR /app

# Create the non-root user
RUN adduser -D app
USER app
RUN adduser -D caddy
USER caddy

# Copy files
COPY --from=builder /app/deployment/Caddyfile /app/Caddyfile
COPY --from=builder /app/dist /app/dist
RUN rm -rf /etc/caddy/Caddyfile /usr/share/caddy
COPY --from=builder /dev/deployment/Caddyfile /etc/caddy/Caddyfile
COPY --from=builder /dev/dist /usr/share/caddy

# Expose port
EXPOSE 8080

# Run Caddy
CMD ["caddy", "run", "--config", "/app/Caddyfile"]
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

# Health check (Note: the server grace period is 30 seconds)
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=2 CMD wget --quiet --tries=1 --spider http://localhost:8081 || exit 1
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Privacy: FC = () => {
// Hooks
const privacyPolicy = useAsync(async () => {
// Fetch the privacy policy
const response = await fetch("/legal/privacy-policy.md");
const response = await fetch("/custom/privacy-policy.md");

// Convert the response to text
return await response.text();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Terms: FC = () => {
// Hooks
const termsAndConditions = useAsync(async () => {
// Fetch the terms and conditions
const response = await fetch("/legal/terms-and-conditions.md");
const response = await fetch("/custom/terms-and-conditions.md");

// Convert the response to text
return await response.text();
Expand Down

0 comments on commit b9777ef

Please sign in to comment.