Skip to content

Commit

Permalink
feat: docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
account0123 committed Mar 11, 2024
1 parent 7776506 commit c3e8992
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
tags: "IMAGE"
tags: "uprising/upvite:latest"
# For pull requests, export results to the build cache.
# Otherwise, push to a registry.
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry,push=true' }}
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM oven/bun:latest as base
WORKDIR /usr/src/upvite

FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .

# build app
ARG API_URL=http://localhost:8000
ENV PUBLIC_API_URL=$API_URL
ENV NODE_ENV=production
RUN bun run build

# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT ["bun", "build/index.js"]
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@
"devlop": "^1.1.0",
"dotenv": "^16.3.2",
"estree-util-is-identifier-name": "^3.0.0",
"fluent-svelte": "^1.6.0",
"hast-util-whitespace": "^3.0.0",
"mdast-util-mdx-expression": "^2.0.0",
"mdast-util-mdx-jsx": "^3.1.0",
"mdast-util-mdxjs-esm": "^2.0.1",
"property-information": "^6.4.1",
"rehype-parse": "^9.0.0",
"space-separated-tokens": "^2.0.2",
"style-to-object": "^1.0.5",
"svelte": "^4.2.7",
"svelte-boxicons": "^1.0.2",
"svelte-adapter-bun": "^0.5.2",
"svelte-check": "^3.6.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
Expand Down Expand Up @@ -71,13 +69,15 @@
"dayjs": "^1.11.10",
"detect-browser": "^5.3.0",
"eventemitter3": "^5.0.1",
"fluent-svelte": "^1.6.0",
"json-stringify-deterministic": "^1.0.12",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"lodash.defaultsdeep": "^4.6.1",
"lodash.isequal": "^4.5.0",
"mobx": "^6.12.0",
"prismjs": "^1.29.0",
"rehype-parse": "^9.0.0",
"rehype-prism": "^2.3.2",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
Expand All @@ -86,6 +86,7 @@
"remark-rehype": "^11.1.0",
"revkit": "^1.1.14",
"revolt.js": "6.0.20-patch.2",
"svelte-boxicons": "^1.0.4",
"svelte-dnd-action": "^0.9.39",
"svelte-i18n": "^4.0.0",
"svelte-mobx": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion 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 "svelte-adapter-bun";
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
Expand Down

0 comments on commit c3e8992

Please sign in to comment.