Skip to content

Commit

Permalink
Revert "Build and Push Docker Image Workflow (#192)"
Browse files Browse the repository at this point in the history
This reverts commit ca4c4c0.
  • Loading branch information
FelixTJDietrich committed Dec 9, 2024
1 parent 6d99917 commit 4bebd4e
Show file tree
Hide file tree
Showing 34 changed files with 169 additions and 377 deletions.
88 changes: 0 additions & 88 deletions .github/workflows/build-and-push-docker.yml

This file was deleted.

1 change: 1 addition & 0 deletions build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nixpacks build -n hephaestus-application-server server/application-server
32 changes: 2 additions & 30 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
services:
webapp:
build:
context: ./webapp
ports:
- '80'
environment:
- APPLICATION_CLIENT_URL
- APPLICATION_SERVER_URL
- SENTRY_DNS
- KEYCLOAK_URL
- KEYCLOAK_REALM
- KEYCLOAK_CLIENT_ID
- KEYCLOAK_SKIP_LOGIN
- LEGAL_IMPRINT_HTML
- LEGAL_PRIVACY_HTML
- UMAMI_ENABLED
- UMAMI_SCRIPT_URL
- UMAMI_WEBSITE_ID
- UMAMI_DOMAINS
depends_on:
- application-server
networks:
- app-network

application-server:
build:
context: ./server/application-server
image: hephaestus-application-server
ports:
- '8080'
environment:
Expand Down Expand Up @@ -91,7 +66,4 @@ services:

networks:
app-network:
driver: bridge

volumes:
postgresql-data:
driver: bridge`
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": "0.0.1",
"name": "hephaestus",
"workspaces": [
"webapp/*"
Expand Down
26 changes: 0 additions & 26 deletions server/application-server/Dockerfile

This file was deleted.

8 changes: 8 additions & 0 deletions server/application-server/nixpacks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[variables]
NIXPACKS_JDK_VERSION = '21'

[phases.setup]
aptPkgs = ["...", "wget"]

[phases.build]
cmds = ["chmod +x ./mvnw", "./mvnw -DskipTests clean package"]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spring:
issuer-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}

hephaestus:
host-url: ${APPLICATION_CLIENT_URL}
host-url: ${APPLICATION_HOST_URL}

leaderboard:
schedule:
Expand All @@ -33,8 +33,8 @@ hephaestus:
keycloak:
url: ${KEYCLOAK_URL}
realm: ${KEYCLOAK_REALM}
client-id: ${KEYCLOAK_CONFIDENTIAL_CLIENT_ID}
client-secret: ${KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET}
client-id: ${KEYCLOAK_CLIENT_ID}
client-secret: ${KEYCLOAK_CLIENT_SECRET}

nats:
enabled: ${NATS_ENABLED:false}
Expand Down
80 changes: 47 additions & 33 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,60 @@
FROM node:22 AS build
FROM node:latest as build

WORKDIR /app

COPY package.json package-lock.json ./
COPY ./ /app/

# Ensure .env file exists
RUN mv .env* .env || true
RUN touch .env
RUN cat .env

# Fix buggy replacement of COOLIFY_URL in .env
RUN COOLIFY_URL_VALUE=$(grep '^COOLIFY_URL=' .env | cut -d '=' -f2) && \
sed -i "s|\$COOLIFY_URL|$COOLIFY_URL_VALUE|g" .env

# Export environment variables from .env
# This assumes that .env contains lines like VARIABLE=value
# and does not contain spaces around the '='
RUN set -a && \
. /app/.env && \
set +a && \
echo "Generating environment.prod.ts" && \
cat > src/environments/environment.prod.ts <<EOF
export const environment = {
clientUrl: '${APPLICATION_CLIENT_URL}',
serverUrl: '${APPLICATION_SERVER_URL}',
version: '${APPLICATION_VERSION}',
sentry: {
dsn: '${SENTRY_DSN}',
environment: 'prod',
},
keycloak: {
url: '${KEYCLOAK_URL}',
realm: '${KEYCLOAK_REALM}',
clientId: '${KEYCLOAK_CLIENT_ID}',
skipLoginPage: ${KEYCLOAK_SKIP_LOGIN}
},
umami: {
enabled: '${UMAMI_ENABLED}',
scriptUrl: '${UMAMI_SCRIPT_URL}',
websiteId: '${UMAMI_WEBSITE_ID}',
domains: '${UMAMI_DOMAINS}'
},
legal: {
imprintHtml: '${LEGAL_IMPRINT_HTML}',
privacyHtml: '${LEGAL_PRIVACY_HTML}'
}
};
EOF

RUN npm install

COPY . ./

RUN npm run build

# Extract version from package.json and save to version.txt
RUN node -e "console.log(require('./package.json').version)" > /app/version.txt

FROM nginx:stable-alpine

ENV APPLICATION_CLIENT_URL=https://default-client.url
ENV APPLICATION_SERVER_URL=https://default-server.url

ENV SENTRY_DNS=https://[email protected]/3

ENV KEYCLOAK_URL=https://default-keycloak.url
ENV KEYCLOAK_REALM=default-realm
ENV KEYCLOAK_CLIENT_ID=default-client-id
ENV KEYCLOAK_SKIP_LOGIN=false

ENV LEGAL_IMPRINT_HTML="<p>Default Imprint</p>"
ENV LEGAL_PRIVACY_HTML="<p>Default Privacy</p>"

ENV UMAMI_ENABLED=false
ENV UMAMI_SCRIPT_URL=""
ENV UMAMI_WEBSITE_ID=""
ENV UMAMI_DOMAINS=""
FROM nginx:latest

COPY --from=build /app/dist/webapp/browser /usr/share/nginx/html

COPY generate_config.sh /usr/local/bin/generate_config.sh
RUN chmod +x /usr/local/bin/generate_config.sh

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

ENTRYPOINT ["/usr/local/bin/generate_config.sh"]
CMD ["nginx", "-g", "daemon off;"]
6 changes: 6 additions & 0 deletions webapp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"budgets": [
{
"type": "initial",
Expand Down
34 changes: 0 additions & 34 deletions webapp/generate_config.sh

This file was deleted.

19 changes: 8 additions & 11 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4bebd4e

Please sign in to comment.