Merge pull request #85 from EETagent/docker_image

(devOps) - Docker image registry + dependencies update
This commit is contained in:
Vojtěch Jungmann 2022-12-14 12:41:16 +01:00 committed by GitHub
commit ed3d0c3549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 711 additions and 416 deletions

90
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: Create and publish a Docker image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-backend-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out 🚚
uses: actions/checkout@v3
- name: Log in to the Container registry 🔑
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker 🏷️
id: meta
uses: docker/metadata-action@v4
env:
IMAGE_NAME: EETagent/portfolio_backend
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image 🚀
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-frontend-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out 🚚
uses: actions/checkout@v3
- name: Extract frontend 🚜
run: |
shopt -s extglob
rm -r !(frontend)/
mv frontend/* ./
- name: Log in to the Container registry 🔑
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker 🏷️
id: meta
uses: docker/metadata-action@v4
env:
IMAGE_NAME: EETagent/portfolio_frontend
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image 🚀
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,12 +1,9 @@
FROM rust:latest
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_PORT=8000
WORKDIR /app
RUN cargo install cargo-watch
COPY ./ ./
RUN cargo build
FROM rust:latest as builder
WORKDIR /portfolio
COPY . .
RUN cargo build --release
FROM debian:bullseye-slim
#RUN apt-get update && apt-get install -y PRIPADNE_DEPS && rm -rf /var/lib/apt/lists/*
COPY --from=builder /portfolio/target/release/portfolio /usr/local/bin/portfolio
CMD ["portfolio"]

12
Dockerfile.dev Normal file
View file

@ -0,0 +1,12 @@
FROM rust:latest
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_PORT=8000
WORKDIR /app
RUN cargo install cargo-watch
COPY ./ ./
RUN cargo build

19
frontend/Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM node:19-bullseye-slim
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm i -g pnpm
RUN pnpm install
COPY . .
RUN pnpm run build
FROM node:19-bullseye-slim
WORKDIR /app
COPY --from=0 /app .
COPY . .
EXPOSE 3000
CMD ["node", "./build"]

View file

@ -14,28 +14,28 @@
},
"devDependencies": {
"@playwright/test": "1.25.0",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"eslint": "^8.28.0",
"@sveltejs/adapter-node": "1.0.0-next.105",
"@sveltejs/kit": "1.0.0-next.587",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.8.1",
"prettier-plugin-tailwindcss": "^0.2.0",
"svelte": "^3.53.1",
"svelte-check": "^2.9.2",
"svelte-preprocess": "^4.10.7",
"prettier": "^2.8.1",
"prettier-plugin-svelte": "^2.9.0",
"prettier-plugin-tailwindcss": "^0.2.1",
"svelte": "^3.55.0",
"svelte-check": "^2.10.2",
"svelte-preprocess": "^5.0.0",
"svelte-windicss-preprocess": "^4.2.8",
"tslib": "^2.4.1",
"typescript": "^4.9.3",
"vite": "^3.2.4",
"typescript": "^4.9.4",
"vite": "^4.0.1",
"windicss": "^3.5.6"
},
"type": "module",
"dependencies": {
"axios": "^1.2.0",
"axios": "^1.2.1",
"filedrop-svelte": "^0.1.2",
"fuse.js": "^6.6.2",
"isomorphic-dompurify": "^0.24.0",

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-node';
import preprocess from 'svelte-preprocess';
import { windi } from 'svelte-windicss-preprocess';
@ -8,7 +8,7 @@ const config = {
// for more information about preprocessors
preprocess: [preprocess(), windi({})],
kit: {
adapter: adapter()
adapter: adapter({ out: 'build' })
}
};