Skip to content

Commit

Permalink
Docker: переходим на alpine-image (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyberorg committed Jul 18, 2022
1 parent 28ef78a commit a6ffa07
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: mvn --batch-mode --update-snapshots clean package -P production-mode

- name: Pull latest base and build images
run: docker pull kio.ee/hub/library/adoptopenjdk:15-jre-openj9
run: docker pull kio.ee/lib/eclipse-temurin:17-jre-alpine

- name: Docker build and tag
run: docker build -f Dockerfile -t kio.ee/kyberorg/whoami:current .
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ package.json
webpack.config.js
webpack.generated.js

/frontend/index.html
/frontend/generated/
/tsconfig.json
/types.d.ts
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
FROM adoptopenjdk:15-jre-openj9
FROM kio.ee/lib/eclipse-temurin:17-jre-alpine as runner
LABEL maintainer="Aleksandr Muravja <alex@kyberorg.io>"

# see https://yls.ee/NNRXyg (issue about sed https->http in alpine)
# see https://yls.ee/WPJIZF (issue about updating those packages)
RUN sed -i 's,https,http,g' /etc/apk/repositories && \
apk add --update-cache \
jq \
curl \
libcrypto1.1=1.1.1q-r0 \
libssl1.1=1.1.1q-r0 && \
rm -rf /var/cache/apk/*

VOLUME /tmp

COPY ./target/whoami.jar /app/
COPY ./docker-entrypoint.sh /

RUN sh -c 'chmod +x /docker-entrypoint.sh'
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y netcat curl jq && \
apt -y autoremove && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ./docker-entrypoint.sh

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.kyberorg</groupId>
<artifactId>whoami</artifactId>
<version>1.0</version>
<version>current</version>
<packaging>jar</packaging>

<name>WhoAmI</name>
Expand All @@ -30,8 +30,8 @@
</scm>

<properties>
<java.version>15</java.version>
<vaadin.version>14.6.3</vaadin.version>
<java.version>17</java.version>
<vaadin.version>23.1.3</vaadin.version>
<!-- Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand All @@ -40,7 +40,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.1</version>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -85,7 +85,7 @@
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.17.2</version>
<version>6.6.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/io/kyberorg/whoami/WebApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package io.kyberorg.whoami;

import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.component.page.Inline;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.component.page.Viewport;
import com.vaadin.flow.server.AppShellSettings;
import com.vaadin.flow.server.PWA;
import com.vaadin.flow.spring.annotation.SpringComponent;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;

@SpringComponent
@Push
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
@PWA(
name = "Site about @kyberorg",
shortName = "whoami",
offlinePath = "offline-page.html",
offlineResources = {"images/logo.jpg"},
description = "WhoAmI: site about @kyberorg")
@Theme(themeClass = Lumo.class, variant = Lumo.DARK)
public class WebApp implements AppShellConfigurator {
@Override
public void configurePage(final AppShellSettings settings) {
settings.addFavIcon("icon", "/icons/favicon-32x32.png", "32x32");
settings.addLink("shortcut icon", "/icons/favicon-16x16.png");
settings.addLink("apple-touch-icon", "/icons/apple-touch-icon.png");
settings.addLink("manifest", "/site.webmanifest");
settings.addLink("mask-icon", "/icons/safari-pinned-tab.svg");

settings.addMetaTag("apple-mobile-web-app-title", "WhoAmI");
settings.addMetaTag("application-name", "WhoAmI");
settings.addMetaTag("msapplication-TileColor", "#ffc40d");
settings.addMetaTag("theme-color", "#ffffff");

//SEO tags
settings.addMetaTag("title","Kyberorg.io - Site about kyberorg");
settings.addMetaTag("description", "Site about Aleksandr Muravja aka kyberorg");
settings.addMetaTag("og:type","website");
settings.addMetaTag("og:url", "https://kyberorg.io/");
settings.addMetaTag("og:title", "Kyberorg.io - Site about kyberorg");
settings.addMetaTag("og:image", "https://kyberorg.io/images/preview.png");
settings.addMetaTag("twitter:card","summary_large_image");
settings.addMetaTag("twitter:url", "https://kyberorg.io/");
settings.addMetaTag("twitter:title","Kyberorg.io - Site about kyberorg");
settings.addMetaTag("twitter:description", "Site about Aleksandr Muravja aka kyberorg");
settings.addMetaTag("twitter:image", "https://kyberorg.io/images/preview.png");

//Splash (Loading) Screen
settings.addInlineFromFile("splash-screen.html", Inline.Wrapping.NONE);
//Google Analytics
settings.addInlineFromFile("gtag.html", Inline.Wrapping.NONE);
}
}
43 changes: 1 addition & 42 deletions src/main/java/io/kyberorg/whoami/ui/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,9 @@

@SpringComponent
@UIScope
@Push
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
@PWA(
name = "Site about @kyberorg",
shortName = "whoami",
offlinePath = "offline-page.html",
offlineResources = {"images/logo.jpg"},
description = "WhoAmI: site about @kyberorg")
@Theme(value = Lumo.class, variant = Lumo.DARK)
@PageTitle("Kyberorg.io - Site about kyberorg")
@Route("")
public class MainView extends VerticalLayout implements PageConfigurator {

public class MainView extends VerticalLayout {
public MainView() {
Component titleSection = TitleSection.getInstance();

Expand Down Expand Up @@ -70,35 +60,4 @@ public MainView() {
UI.getCurrent().getPage().executeJs(
"document.querySelector('#splash-screen').classList.add('loaded')");
}
@Override
public void configurePage(InitialPageSettings settings) {
settings.addFavIcon("icon", "/icons/favicon-32x32.png", "32x32");
settings.addLink("shortcut icon", "/icons/favicon-16x16.png");
settings.addLink("apple-touch-icon", "/icons/apple-touch-icon.png");
settings.addLink("manifest", "/site.webmanifest");
settings.addLink("mask-icon", "/icons/safari-pinned-tab.svg");

settings.addMetaTag("apple-mobile-web-app-title", "WhoAmI");
settings.addMetaTag("application-name", "WhoAmI");
settings.addMetaTag("msapplication-TileColor", "#ffc40d");
settings.addMetaTag("theme-color", "#ffffff");

//SEO tags
settings.addMetaTag("title","Kyberorg.io - Site about kyberorg");
settings.addMetaTag("description", "Site about Aleksandr Muravja aka kyberorg");
settings.addMetaTag("og:type","website");
settings.addMetaTag("og:url", "https://kyberorg.io/");
settings.addMetaTag("og:title", "Kyberorg.io - Site about kyberorg");
settings.addMetaTag("og:image", "https://kyberorg.io/images/preview.png");
settings.addMetaTag("twitter:card","summary_large_image");
settings.addMetaTag("twitter:url", "https://kyberorg.io/");
settings.addMetaTag("twitter:title","Kyberorg.io - Site about kyberorg");
settings.addMetaTag("twitter:description", "Site about Aleksandr Muravja aka kyberorg");
settings.addMetaTag("twitter:image", "https://kyberorg.io/images/preview.png");

//Splash (Loading) Screen
settings.addInlineFromFile("splash-screen.html", InitialPageSettings.WrapMode.NONE);
//Google Analytics
settings.addInlineFromFile("gtag.html", InitialPageSettings.WrapMode.NONE);
}
}

0 comments on commit a6ffa07

Please sign in to comment.