Skip to content

Commit 66aa5b5

Browse files
Adding Dockerfile
1 parent b941943 commit 66aa5b5

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# docker build -t sqlitcloud-gateway .
2+
# docker run -p 8090:8090 -p 4000:4000 --name sqlitecloud-gateway sqlitecloud-gateway
3+
4+
# use the official Bun image
5+
# see all versions at https://hub.docker.com/r/oven/bun/tags
6+
FROM oven/bun:1 as base
7+
WORKDIR /usr/src/app
8+
9+
# install dependencies into temp directory
10+
# this will cache them and speed up future builds
11+
FROM base AS install
12+
RUN mkdir -p /temp/dev
13+
COPY package.json bun.lockb /temp/dev/
14+
RUN cd /temp/dev && bun install --frozen-lockfile
15+
16+
# install with --production (exclude devDependencies)
17+
RUN mkdir -p /temp/prod
18+
COPY package.json bun.lockb /temp/prod/
19+
RUN cd /temp/prod && bun install --frozen-lockfile --production
20+
21+
# copy node_modules from temp directory
22+
# then copy all (non-ignored) project files into the image
23+
FROM base AS prerelease
24+
COPY --from=install /temp/dev/node_modules node_modules
25+
COPY . .
26+
27+
# [optional] tests & build
28+
ENV NODE_ENV=production
29+
#RUN bun test
30+
#RUN bun run build
31+
RUN bun build ./src/gateway/gateway.ts --compile --outfile ./sqlitecloud-gateway.out
32+
33+
# copy production dependencies and source code into final image
34+
FROM base AS release
35+
COPY --from=install /temp/prod/node_modules node_modules
36+
COPY --from=prerelease /usr/src/app/src ./src
37+
COPY --from=prerelease /usr/src/app/public ./public
38+
COPY --from=prerelease /usr/src/app/package.json .
39+
COPY --from=prerelease /usr/src/app/sqlitecloud-gateway.out .
40+
41+
# run the app
42+
USER bun
43+
44+
EXPOSE 4000/tcp
45+
EXPOSE 8090/tcp
46+
47+
#ENTRYPOINT [ "bun", "run", "./src/gateway/gateway.ts" ]
48+
ENTRYPOINT [ "./sqlitecloud-gateway.out" ]

bun.lockb

271 KB
Binary file not shown.

src/drivers/connection-tls.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
218218
})
219219

220220
this.socket?.write(commands, 'utf8', () => {
221+
// @ts-ignore
221222
socketTimeout = setTimeout(() => {
222223
const timeoutError = new SQLiteCloudError('Request timed out', { cause: anonimizeCommand(commands) })
223224
// console.debug(`Request timed out, config.timeout is ${this.config?.timeout as number}ms`, timeoutError)

0 commit comments

Comments
 (0)