Skip to content

Commit

Permalink
fix: question generator + fix for front?
Browse files Browse the repository at this point in the history
Co-authored-by: Gonzalo Suárez Losada <[email protected]>
  • Loading branch information
Toto-hitori committed Mar 11, 2024
1 parent bb81584 commit 117cc12
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4

- name: Create .env file
run: echo "REACT_APP_API_ENDPOINT=${{ secrets.DEPLOY_HOST }}:8080" > webapp/.env
run: echo "REACT_APP_API_ENDPOINT=http://${{ secrets.DEPLOY_HOST }}:8080" > webapp/.env

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
Expand All @@ -89,6 +89,25 @@ jobs:
workdir: webapp
buildargs: |
REACT_APP_API_ENDPOINT
docker-push-question-generator:
runs-on: ubuntu-latest
needs: [ e2e-tests ]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
with:
name: arquisoft/wiq_en2b/question-generator
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: questiongenerator
buildargs: |
DATABASE_USER
DATABASE_PASSWORD
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
Expand All @@ -113,4 +132,4 @@ jobs:
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env
echo "API_URI=http://${{ secrets.DEPLOY_HOST }}:8080" >> .env
docker compose --profile prod down
docker compose --profile prod up -d
docker compose --profile prod up -d --pull
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ services:
ports:
- "8080:8080"

question-generator:
container_name: question-generator-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en2b/question-generator:latest
profiles: [ "dev", "prod" ]
build:
context: ./questiongenerator
args:
DATABASE_USER: ${DATABASE_USER}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
environment:
- DATABASE_URL=jdbc:postgresql://WIQ_DB:5432/wiq
- DATABASE_USER=${DATABASE_USER}
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
networks:
- mynetwork

webapp:
container_name: webapp-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en2b/webapp:latest
Expand Down
19 changes: 19 additions & 0 deletions questiongenerator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM maven:3.8.1-openjdk-17 AS build
LABEL authors="dario"
# Compile api
COPY . /questiongenerator
WORKDIR /questiongenerator
RUN mvn install
RUN mvn clean package

FROM amazoncorretto:17 AS runtime
# Copy the compiled jar file from the build stage
ARG DATABASE_USER
ARG DATABASE_PASSWORD

# Set environment variables
ENV DATABASE_URL jdbc:postgresql://WIQ_DB:5432/wiq
ENV DATABASE_USER $DATABASE_USER
ENV DATABASE_PASSWORD $DATABASE_PASSWORD
COPY --from=build /api/target/QuestionGenerator-1.0-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","app.jar"]

0 comments on commit 117cc12

Please sign in to comment.