From 8b791e30412f9a6297587413adb0f2cdcbcdbe94 Mon Sep 17 00:00:00 2001 From: Ayush Kumar <140801177+ayush-129@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:58:07 +0530 Subject: [PATCH] enabled devcontainers --- .devcontainer/Dockerfile | 31 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 23 +++++++++++++++++++++++ vite.config.ts | 3 +++ 3 files changed, 57 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..23c099b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,31 @@ +#BUILDER +FROM node:19-alpine as builder + +#Make the builder directory +WORKDIR /website_fosscu + +#COPY build source from project +COPY package*.json . +COPY yarn.lock . + +#Copy all files into container +COPY . . + +#Installing all dependencies +RUN yarn install + + +#MAIN +FROM node:19-alpine as main + +#Make main app directory +WORKDIR /app + +#Copy all from builder stage +COPY --from=builder /website_fosscu/. ./ + +# Run the production build +RUN yarn build + +# Start the server +CMD ["yarn", "start"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..bdb4fb1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "website-fosscu", + "dockerFile": "Dockerfile", + "context": "..", + "remoteUser": "node", + "forwardPorts": [8080], + "postCreateCommand": "yarn", + "shutdownAction": "none", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "editor.formatOnSave": true, + "eslint.alwaysShowStatus": true + }, + "extensions": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "ms-azuretools.vscode-docker" + ] + } + } +} diff --git a/vite.config.ts b/vite.config.ts index dcf968d..56cb2d6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,5 +12,8 @@ export default defineConfig({ }, define: { 'process.env': process.env + }, + server: { + port: 8080, // Set the desired port here } }); \ No newline at end of file