dockerize th repo

This commit is contained in:
hexboy 2024-07-07 00:38:40 +03:30
parent d325bc50e4
commit 86adff94cb
3 changed files with 75 additions and 0 deletions

35
.dockerignore Normal file
View file

@ -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

31
Dockerfile Normal file
View file

@ -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}

9
compose.yaml Normal file
View file

@ -0,0 +1,9 @@
services:
mirror:
image: hexboy2011/maven-mirror-tool
build:
context: .
environment:
NODE_ENV: production
ports:
- 8008:8008