Skip to content

Commit

Permalink
fix(#19): docker's compatibility with swc
Browse files Browse the repository at this point in the history
  • Loading branch information
barthofu committed Aug 17, 2022
1 parent f0e71b3 commit 49bc00f
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 417 deletions.
19 changes: 13 additions & 6 deletions .docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## build runner
FROM node:16.16-alpine as build-runner
FROM node:16.17-alpine as build-runner

# Set temp directory
WORKDIR /tmp/app
Expand All @@ -9,20 +9,23 @@ COPY package.json .
COPY package-lock.json .

# Install dependencies from package-lock.json
RUN npm ci
RUN npm ci && npm cache clean --force

# Move source files
COPY src ./src
COPY assets ./assets

COPY .swcrc .
COPY tsconfig.json .
COPY mikro-orm.config.ts .

# Build project
RUN npm run build

## producation runner
FROM node:16.16-alpine as prod-runner
FROM node:16.17-alpine as prod-runner

# set production mode
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

# Set work directory
WORKDIR /app
Expand All @@ -35,4 +38,8 @@ COPY --from=build-runner /tmp/app/package-lock.json /app/package-lock.json
RUN npm ci --omit=dev

# Move build files
COPY --from=build-runner /tmp/app/build /app/build
COPY --from=build-runner /tmp/app/build /app/build
# COPY assets /app/assets

# Finaly start the bot
CMD ["node", "build/main.js"]
4 changes: 1 addition & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],

"args": ["src/main.ts"],


"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ services:
build:
context: ./
dockerfile: ./.docker/app/Dockerfile
command: "npm run serve"
env_file:
- .env
ports:
- 4000:4000
volumes:
- ./database:/app/database
- ./logs/:/app/logs
- ./assets:/app/assets
restart: always
networks:
- dev
Expand Down
Loading

0 comments on commit 49bc00f

Please sign in to comment.