Skip to content

Commit

Permalink
Merge pull request #1889 from scpwiki/WJ-994-dev-docker
Browse files Browse the repository at this point in the history
[WJ-994] Fix framerail build in Docker
  • Loading branch information
emmiegit authored Apr 22, 2024
2 parents 3fac0e4 + 4c8ec79 commit 2896521
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/docker-build-web.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: '[backend] Docker build Framerail (dev)'

on:
pull_request:
paths:
- 'framerail/**'
- 'install/aws/dev/docker/web/Dockerfile'
- '.github/workflows/docker-build-web.dev.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build image
run: docker build -f install/aws/dev/docker/web/Dockerfile .
env:
DOCKER_BUILDKIT: 1
21 changes: 21 additions & 0 deletions .github/workflows/docker-build-web.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: '[backend] Docker build Framerail (local)'

on:
pull_request:
paths:
- 'framerail/**'
- 'install/local/dev/web/Dockerfile'
- '.github/workflows/docker-build-web.local.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build image
run: docker build -f install/local/dev/web/Dockerfile .
env:
DOCKER_BUILDKIT: 1

20 changes: 20 additions & 0 deletions .github/workflows/docker-build-web.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: '[backend] Docker build Framerail (prod)'

on:
pull_request:
paths:
- 'framerail/**'
- 'install/aws/prod/docker/web/Dockerfile'
- '.github/workflows/docker-build-web.prod.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build image
run: docker build -f install/aws/prod/docker/web/Dockerfile .
env:
DOCKER_BUILDKIT: 1
10 changes: 5 additions & 5 deletions framerail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "framerail",
"version": "2023.5.7",
"type": "module",
"private": true,
"scripts": {
"dev": "vite dev",
Expand All @@ -15,11 +16,10 @@
},
"devDependencies": {
"@playwright/test": "^1.43.1",
"@types/accept-language-parser": "^1.5.6",
"@types/node": "^20.12.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"accept-language-parser": "^1.5.0",
"@types/accept-language-parser": "^1.5.6",
"@types/node": "^20.12.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
Expand All @@ -38,10 +38,10 @@
"stylelint-scss": "^6.2.1",
"typescript": "^5.4.5"
},
"type": "module",
"dependencies": {
"@sveltejs/adapter-auto": "next",
"@sveltejs/adapter-node": "next",
"@sveltejs/kit": "next",
"accept-language-parser": "^1.5.0",
"json-rpc-2.0": "^1.7.0",
"svelte": "^3.59.2",
"svelte-check": "^3.6.8",
Expand Down
8 changes: 4 additions & 4 deletions framerail/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion framerail/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from "@sveltejs/adapter-auto"
import adapter from "@sveltejs/adapter-node"
import preprocess from "svelte-preprocess"

/** @type {import("@sveltejs/kit").Config} */
Expand Down
2 changes: 1 addition & 1 deletion install/aws/dev/docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN cargo build --release
#

# We want alpine, but need glibc
FROM frolvlad/alpine-glibc:glibc-2.30
FROM frolvlad/alpine-glibc:glibc-2.34

ENV LOCALIZATION_PATH="/opt/locales"

Expand Down
28 changes: 28 additions & 0 deletions install/aws/dev/docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Framerail build
#

FROM node:19-alpine

# Install pnpm
RUN npm install -g pnpm

# Copy sources
RUN mkdir /app
WORKDIR /app
COPY framerail/ ./
COPY assets ./src/assets

# Install app
RUN \
pnpm install && \
pnpm build && \
pnpm prune --prod && \
rm -rf src/ tests/

# Run command
USER node:node
ENV NODE_ENV=production
EXPOSE 3000

CMD ["/usr/local/bin/node", "build"]
28 changes: 28 additions & 0 deletions install/aws/prod/docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Framerail build
#

FROM node:19-alpine

# Install pnpm
RUN npm install -g pnpm

# Copy sources
RUN mkdir /app
WORKDIR /app
COPY framerail/ ./
COPY assets ./src/assets

# Install app
RUN \
pnpm install && \
pnpm build && \
pnpm prune --prod && \
rm -rf src/ tests/

# Run command
USER node:node
ENV NODE_ENV=production
EXPOSE 3000

CMD ["/usr/local/bin/node", "build"]
29 changes: 0 additions & 29 deletions install/local/dev/web/Dockerfile.production

This file was deleted.

0 comments on commit 2896521

Please sign in to comment.