-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
97 add docker and GitHub workflow #98
Draft
kurunbelemir
wants to merge
13
commits into
main
Choose a base branch
from
97-add-docker-and-github-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5e4b2cb
feat: create dockeriziation for frontend
egenerse f50fedf
Merge branch 'main' into feat/dockerize-monorepo
egenerse 32726a9
feat: update dockerfile and package-lock
egenerse 0f0bc34
feat: script and readme
egenerse b1cc9dc
Merge branch 'main' into feat/dockerize-monorepo
kurunbelemir 3bbecc9
ci: add github workflow
kurunbelemir e5eae6e
ci: update yml files
kurunbelemir 178a948
ci: compose for workflow
kurunbelemir a33b834
ci: update yml file name
kurunbelemir be37e71
ci: update included branches
kurunbelemir 9307d8b
ci: correct yml file name
kurunbelemir a031c82
ci: make repo name lowercase
kurunbelemir 6018fb9
ci: update deploy-prod.yml
kurunbelemir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
.git | ||
.DS_Store | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: # Adjust the triggers, conditions, etc. to your needs, see examples below | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- feat/* | ||
- 97-add-docker-and-github-workflow | ||
|
||
|
||
jobs: | ||
# You can also build and push multiple images in parallel using a matrix (see examples) | ||
build-and-push-workflow: | ||
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main | ||
with: | ||
image-name: ls1intum/apollon2/apollon_reenginerring | ||
docker-file: Dockerfile | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy to Development | ||
|
||
on: | ||
workflow_dispatch: # For manual triggers via the GitHub Actions UI | ||
inputs: | ||
image-tag: | ||
type: string | ||
description: "Image tag to deploy (default: pr-<number> if PR exists, latest for default branch)" | ||
|
||
jobs: | ||
deploy: | ||
uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main | ||
with: | ||
environment: Production # Replace with your environment | ||
docker-compose-file: "./docker-compose.prod.yml" # Path to your docker-compose file | ||
main-image-name: ls1intum/apollon2 | ||
image-tag: ${{ inputs.image-tag }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger on pushes to the main branch | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME_EGE }} #Will be changed later | ||
password: ${{ secrets.DOCKERHUB_PASSWORD_EGE }} #Will be changed later | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: egenerse45/apollon2-webapp:latest, egenerse45/apollon2-webapp:v1.0 #Will be changed later | ||
|
||
- name: Logout from Docker Hub | ||
run: docker logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Stage 1: Builder | ||
FROM node:20.18.0-slim AS builder | ||
|
||
# Create and set working directory | ||
WORKDIR /app | ||
|
||
# Copy root-level package and lock files | ||
COPY package*.json ./ | ||
# Copy workspace package files (if needed) | ||
COPY library/package*.json ./library/ | ||
COPY standalone/webapp/package*.json ./standalone/webapp/ | ||
COPY standalone/server/package*.json ./standalone/server/ | ||
|
||
# Install all dependencies for the entire monorepo using npm ci | ||
RUN npm install | ||
|
||
# Copy all source code into the image | ||
COPY . . | ||
|
||
# Build the webapp - assuming there's a script at the root or | ||
# you can directly run: | ||
RUN npm run build | ||
|
||
# Stage 2: Production image | ||
FROM nginx:alpine | ||
# Remove default nginx pages | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
# Copy the built webapp from the builder stage | ||
COPY --from=builder /app/standalone/webapp/dist /usr/share/nginx/html | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
# Default command to run nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3.8' | ||
|
||
services: | ||
webapp: | ||
image: "ghcr.io/ls1intum/apollon2/apollon2:${IMAGE_TAG}" | ||
ports: | ||
- "8080:80" | ||
|
||
restart: unless-stopped |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we use GitHub container registry, should we keep scripts related to the docker hub? We don't need to also publish to the docker hub I guess.