diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8b6800f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,35 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json +!.vscode/launch.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.yarn/cache +.yarn/install-state.gz +.yarn/unplugged + +.eslintcache \ No newline at end of file diff --git a/.gitignore b/.gitignore index 12bc57e..306299c 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,5 @@ coverage *.sw? .yarn/cache .yarn/install-state.gz - +.yarn/unplugged .eslintcache \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b0bdcdb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM node:16 AS builder + +WORKDIR /app + +COPY package.json . +COPY yarn.lock . +COPY .yarn/releases/* .yarn/releases/ +COPY .yarnrc.yml . +RUN yarn install + +COPY . . + +RUN yarn build + +# nginx state for serving content +FROM nginx:alpine +# Set working directory to nginx asset directory +WORKDIR /usr/share/nginx/html +# Remove default nginx static assets +RUN rm -rf ./* +# Copy static assets from builder stage +COPY --from=builder /app/dist . +COPY nginx.conf /etc/nginx/conf.d/default.conf +# Containers run nginx with global directives and daemon off +ENTRYPOINT ["nginx", "-g", "daemon off;"] + +LABEL \ + org.label-schema.name="Claptrap Bot" \ + org.label-schema.url="https://claptrapbot.com" \ + org.label-schema.vcs-url="https://github.com/Sebclem/Claptrap-ui" \ + org.label-schema.vendor="Sebclem" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..be791d7 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name frontend; + location / { + root /usr/share/nginx/html/; + index index.html; + include /etc/nginx/mime.types; + try_files $uri $uri/ /index.html; + } +}