Skip to content

Commit

Permalink
feat/docker-image (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart01 authored Jan 2, 2024
1 parent 547ae5c commit 948b0ba
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
51 changes: 51 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,54 @@ jobs:

- name: Code Linting
run: npm run lint

build:
name: Build
if: github.ref == 'refs/heads/main' && success()
needs: linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: scrumlr.io - Landing Page - Build
id: meta-landing-page
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/inovex/scrumlr.io-landing-page/image
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
type=sha,prefix=sha-,format=short
labels: |
[email protected]
org.opencontainers.image.url=https://github.com/inovex/scrumlr.io/pkgs/container/scrumlr.io-landing-page%2Fimage
org.opencontainers.image.source=https://github.com/inovex/scrumlr.io-landing-page
org.opencontainers.image.vendor=inovex
org.opencontainers.image.licenses=MIT
org.opencontainers.image.title=scrumlr.io - Landing Page
org.opencontainers.image.description=The landing page of scrumlr.io
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2

- name: Push landing page image
id: push-landing-page
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta-landing-page.outputs.tags }}
labels: ${{ steps.meta-landing-page.outputs.labels }}
build-args: |
DIRECTUS_URL=${{ secrets.DIRECTUS_URL }}
DIRECTUS_TOKEN=${{ secrets.DIRECTUS_TOKEN }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18 AS build
WORKDIR /app
ARG DIRECTUS_URL
ARG DIRECTUS_TOKEN
COPY package*.json ./
RUN npm install -g pnpm
RUN pnpm install
COPY . .
RUN echo "DIRECTUS_URL = ${DIRECTUS_URL}" >> .env
RUN echo "DIRECTUS_TOKEN = ${DIRECTUS_TOKEN}" >> .env
RUN pnpm run build
RUN rm -rf .env

FROM nginx:alpine AS runtime
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 8080
31 changes: 31 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 8080;
server_name _;

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}

location / {
try_files $uri $uri/index.html =404;
}
}
}
2 changes: 1 addition & 1 deletion src/pages/[lang]/Legal/Cookies.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type {GetStaticPaths} from "astro";
import LegalLayout from "../../../layouts/LegalLayout.astro";
import getTranslatedContent from "../../../utils/directus.ts";
import "./legal.scss";
import "./Legal.scss";
const {lang} = Astro.params;
const content = await getTranslatedContent("Cookie_Policy", lang!);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/Legal/Privacy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type {GetStaticPaths} from "astro";
import LegalLayout from "../../../layouts/LegalLayout.astro";
import getTranslatedContent from "../../../utils/directus.ts";
import "./legal.scss";
import "./Legal.scss";
const {lang} = Astro.params;
const content = await getTranslatedContent("Privacy_Policy", lang!);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/Legal/Terms.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { GetStaticPaths } from "astro";
import LegalLayout from "../../../layouts/LegalLayout.astro";
import getTranslatedContent from "../../../utils/directus.ts";
import "./legal.scss";
import "./Legal.scss";
const {lang} = Astro.params;
const content = await getTranslatedContent("Terms_Conditions", lang!);
Expand Down

0 comments on commit 948b0ba

Please sign in to comment.