diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5d6da2e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,35 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/build +**/dist +**/local-cache +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02bff26 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +ARG NODE_VERSION=22 + +FROM node:${NODE_VERSION}-alpine + +# Use production node environment by default. +ENV NODE_ENV production + +# install and use yarn 4.x +RUN corepack prepare yarn@4.3.1 + +# Run as a root user. +USER root + +# Init local-cache dir +RUN mkdir -p /home/node/app/local-cache +RUN chown -R node:node /home/node/app + +# Set working directory +WORKDIR /home/node/app + +# Run the application as a non-root user. +USER node + +# Copy the rest of the source files into the image. +COPY --chown=node . . + +# Expose the port that the application listens on. +EXPOSE 8008 + +# Run the application. +CMD yarn && yarn run pm2 start --attach --env ${NODE_ENV} diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..9f03124 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,9 @@ +services: + mirror: + image: hexboy2011/maven-mirror-tool + build: + context: . + environment: + NODE_ENV: production + ports: + - 8008:8008