Skip to content

Commit 181935b

Browse files
authored
Add Super Linter (#13)
* Add GitHub Actions workflow for Super Linter * Update Nginx version, enhance GitHub Actions, and refine CSS styles * Refactor footer copyright handling and update Super Linter configuration * Simplify modal CSS grid layout * Enhance Dockerfile for Nginx configuration and adjust CSS layout * Simplify loading spinner positioning using inset property * Update Super Linter configuration and simplify footer copyright element handling
1 parent c01e4fe commit 181935b

File tree

10 files changed

+77
-31
lines changed

10 files changed

+77
-31
lines changed

.github/workflows/super-linter.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
push: null
6+
pull_request: null
7+
8+
permissions: {}
9+
10+
jobs:
11+
build:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: read
17+
packages: read
18+
# To report GitHub Actions status checks
19+
statuses: write
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
# super-linter needs the full git history to get the
26+
# list of files that changed across commits
27+
fetch-depth: 0
28+
29+
- name: Super-linter
30+
uses: super-linter/[email protected]
31+
env:
32+
# To report GitHub Actions status checks
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
VALIDATE_ALL_CODEBASE: false
35+
VALIDATE_CSS_PRETTIER: false
36+
VALIDATE_HTML_PRETTIER: false
37+
VALIDATE_JAVASCRIPT_STANDARD: false
38+
VALIDATE_JAVASCRIPT_PRETTIER: false
39+
VALIDATE_JSON_PRETTIER: false
40+
VALIDATE_YAML_PRETTIER: false

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use the latest nginx as the base image
2-
FROM nginx:latest
2+
FROM nginx:1.27.3
33

44
# Set environment variables
55
ENV TEMP_FRONTEND_DIR=/temp-frontend-files
@@ -10,20 +10,30 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1010
# Create a non-root user and group
1111
RUN groupadd -r frontenduser && useradd -r -g frontenduser frontenduser
1212

13+
# Create a directory for the PID file and assign ownership to frontenduser
14+
RUN mkdir -p /var/run/nginx && chown -R frontenduser:frontenduser /var/run/nginx
15+
1316
# Copy all files to the container
1417
COPY . /usr/share/nginx/html
1518

19+
# Copy nginx.conf to a writable location and modify the PID path
20+
RUN cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.custom && \
21+
sed -i 's|/var/run/nginx.pid|/var/run/nginx/nginx.pid|g' /etc/nginx/nginx.conf.custom
22+
1623
# Set ownership of necessary directories
1724
RUN chown -R frontenduser:frontenduser /usr/share/nginx/html \
1825
&& chown -R frontenduser:frontenduser /var/cache/nginx \
1926
&& chown -R frontenduser:frontenduser /var/log/nginx
2027

28+
# Switch to non-root user
29+
USER frontenduser
30+
2131
# Expose the default nginx port (80)
2232
EXPOSE 80
2333

2434
# Add health check for the container
2535
HEALTHCHECK --interval=1m --timeout=10s --start-period=30s --retries=3 \
2636
CMD curl -f http://localhost/ || exit 1
2737

28-
# Use the default nginx command
29-
CMD ["nginx", "-g", "daemon off;"]
38+
# Use the custom nginx.conf during runtime
39+
CMD ["nginx", "-c", "/etc/nginx/nginx.conf.custom", "-g", "daemon off;"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Nginx HTTP web server
22

3-
This repository contains the front-end for smartcooking.
3+
This repository contains the frontend for smartcooking.
44

55
## Getting Started
66

7-
To set up the front-end locally, you'll need Docker installed. Follow the steps below to build and run the database in a container.
7+
To set up the frontend locally, you'll need Docker installed. Follow the steps below to build and run the database in a container.
88

99
### Setup Steps
1010

@@ -20,5 +20,5 @@ To set up the front-end locally, you'll need Docker installed. Follow the steps
2020
docker run -d --name Smart-Cooking_Frontend -p 8080:80 smartcooking-nginx
2121
```
2222

23-
3. **Access the website**
23+
3. **Access the site**
2424
Open your brower and access `http://localhost:8080/`

authentication.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h1>Smart Cooking &copy;</h1>
5959
</section>
6060
</main>
6161

62-
<footer id="footer-copyright">Smart Cooking &copy; <span id="copyright-year"></span>. All rights reserved.</footer>
62+
<footer id="footer-copyright"></footer>
6363

6464
<script src="javascript/main.js"></script>
6565
<script src="javascript/authentication.js" defer></script>

css/authentication.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ form {
2727
width: clamp(300px, 80%, 600px);
2828
flex-direction: column;
2929
border: 1px solid var(--background-color-secondary);
30-
padding: 2rem 2rem;
30+
padding: 2rem;
3131
border-radius: var(--border-radius);
3232
gap: 1rem;
3333
}
@@ -59,7 +59,7 @@ section {
5959
}
6060

6161
.password-input>label {
62-
background-image: url(../images/tabler--eye.svg);
62+
background-image: "url(../images/tabler--eye.svg)";
6363
height: 2rem;
6464
width: 2rem;
6565
background-repeat: no-repeat;
@@ -68,7 +68,7 @@ section {
6868
}
6969

7070
.show-password-check:checked+label.show-password {
71-
background-image: url(../images/tabler--eye-off.svg);
71+
background-image: "url(../images/tabler--eye-off.svg)";
7272
}
7373

7474
#home {

css/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ section#posts {
5555
.cook-time-icon {
5656
width: var(--icon-size);
5757
height: var(--icon-size);
58-
stroke: currentColor;
58+
stroke: currentcolor;
5959
vertical-align: bottom;
6060
}
6161

css/main.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
--polaroid-height: 107mm;
77
--polaroid-photo-size: 79mm;
88
--polaroid-width: 88mm;
9-
109
--polaroid-margin-top: calc((var(--polaroid-width) - var(--polaroid-photo-size)) / 2);
1110
}
1211

@@ -60,14 +59,11 @@ header {
6059

6160
#loading-spinner {
6261
position: fixed;
63-
top: 0;
64-
left: 0;
65-
right: 0;
66-
bottom: 0;
62+
inset: 0;
6763
display: flex;
6864
justify-content: center;
6965
align-items: center;
70-
background-color: rgba(0, 0, 0, .5);
66+
background-color: rgba(0 0 0 / 50%);
7167
z-index: 1000;
7268
}
7369

css/modal.css

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
box-shadow: var(--polaroid-background-color) 0 0 10px;
1818
display: grid;
1919
gap: 1rem;
20-
grid-template-rows: auto 1fr;
21-
grid-template-columns: 1fr 1fr;
22-
grid-template-areas:
23-
"modal-top modal-top"
24-
"modal-left modal-right";
20+
grid-template:
21+
"modal-top modal-top" auto
22+
"modal-left modal-right" auto / 1fr 1fr;
2523
height: 75%;
2624
width: 60%;
2725
overflow-y: auto;
@@ -66,12 +64,10 @@
6664
@media screen and (width<=850px) {
6765
#modal-box {
6866
border-radius: 0;
69-
grid-template-rows: auto 1fr;
70-
grid-template-columns: 1fr;
71-
grid-template-areas:
72-
"modal-top"
73-
"modal-left"
74-
"modal-right";
67+
grid-template:
68+
"modal-top" auto
69+
"modal-left" auto
70+
"modal-right" auto / 1fr;
7571
height: 80%;
7672
width: 100%;
7773
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2 id="modal-title">Title</h2>
5252

5353
<aside id="loading-spinner"><span id="spinner"></span></aside>
5454

55-
<footer id="footer-copyright">Smart Cooking &copy; <span id="copyright-year"></span>. All rights reserved.</footer>
55+
<footer id="footer-copyright"></footer>
5656

5757
<script src="javascript/main.js"></script>
5858
<script src="javascript/index.js" defer></script>

javascript/footer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ if (currentYear !== baseYear) {
1212
yearString += `-${currentYear}`;
1313
}
1414

15-
// Set the string to the paragraph
16-
document.getElementById('copyright-year').innerText = yearString;
15+
// Create the entire copyright element dynamically
16+
const copyrightElement = document.createElement('div');
17+
copyrightElement.innerHTML = `Smart Cooking &copy; ${yearString}. All rights reserved.`;
18+
19+
// Append the generated element to the body
20+
document.body.appendChild(copyrightElement);

0 commit comments

Comments
 (0)