commit 668a1f018be358158080260897cc1eff1c493365 Author: DataHearth Date: Wed Jan 4 14:08:00 2023 +0100 initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2312f28 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Justfile +Dockerfile +.dockerignore \ No newline at end of file diff --git a/.env b/.env new file mode 100644 index 0000000..6992ceb --- /dev/null +++ b/.env @@ -0,0 +1,36 @@ +# Server + Client +TZ=UTC +PUBLIC_URL=http://localhost:3000 +PUBLIC_SERVER_URL=http://localhost:3100 +PUBLIC_GOOGLE_CLIENT_ID= + +# Server + Database +POSTGRES_DB=postgres +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres + +# Server +SECRET_KEY=CHANGEME +POSTGRES_HOST=localhost +POSTGRES_PORT=5432 +POSTGRES_SSL_CERT= +JWT_SECRET=CHANGEME +JWT_EXPIRY_TIME=604800 +GOOGLE_CLIENT_SECRET= +GOOGLE_API_KEY= +MAIL_FROM_NAME= +MAIL_FROM_EMAIL= +MAIL_HOST= +MAIL_PORT= +MAIL_USERNAME= +MAIL_PASSWORD= +STORAGE_BUCKET= +STORAGE_REGION= +STORAGE_ENDPOINT= +STORAGE_URL_PREFIX= +STORAGE_ACCESS_KEY= +STORAGE_SECRET_KEY= +PDF_DELETION_TIME=345600000 + +# Client +PUBLIC_FLAG_DISABLE_SIGNUPS=false diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..37cd7d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:lts-bullseye-slim + +ARG VERSION + +RUN apt update +RUN apt install -y git + +RUN git clone --depth 1 --branch ${VERSION} https://github.com/AmruthPillai/Reactive-Resume.git app + +RUN npm install -g pnpm pm2 + +WORKDIR /app + +RUN pnpm install --frozen-lockfile +RUN pnpm build + +COPY . . + +RUN cp .env /tmp/.env +RUN mv entrypoint.sh /usr/bin/entrypoint.sh && chmod a+x /usr/bin/entrypoint.sh + +ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] +CMD [ "pm2-runtime", "ecosystem.config.js" ] \ No newline at end of file diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..0811817 --- /dev/null +++ b/Justfile @@ -0,0 +1,27 @@ +default: build-latest + +LATEST_VERSION := `xh https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest Accept:application/vnd.github+json X-GitHub-Api-Version:2022-11-28 | jq .tag_name` + +# build and push latest version of reactive-resume to "gitea" and "docker" +build-latest: + @echo "building images..." + docker build -t gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} --build-arg VERSION={{LATEST_VERSION}} . + docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} gitea.antoine-langlois.net/datahearth/reactive-resume:latest + docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} datahearth/reactive-resume:{{LATEST_VERSION}} + docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} datahearth/reactive-resume:latest + + @echo "pushing images..." + docker push gitea.antoine-langlois.net/datahearth/reactive-resume:{{LATEST_VERSION}} + docker push gitea.antoine-langlois.net/datahearth/reactive-resume:latest + docker push datahearth/reactive-resume:{{LATEST_VERSION}} + docker push datahearth/reactive-resume:latest + +# build and push specific version of reactive-resume to "gitea" and "docker" +build VERSION: + @echo "building images..." + docker build -t gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}} --build-arg VERSION={{VERSION}} . + docker tag gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}} datahearth/reactive-resume:{{VERSION}} + + @echo "pushing images..." + docker push gitea.antoine-langlois.net/datahearth/reactive-resume:{{VERSION}} + docker push datahearth/reactive-resume:{{VERSION}} \ No newline at end of file diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..9a55405 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,12 @@ +module.exports = [ + { + script: "pnpm start --filter server", + cwd: "/app", + name: "server", + }, + { + script: "pnpm start --filter client", + cwd: "/app", + name: "client", + }, +]; diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..6325d45 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [ ! -f .env ]; then + cp /tmp/.env . +fi + +set -a +source .env +set +a + +exec "$@" \ No newline at end of file