diff --git a/docker-compose.yml b/docker-compose.yml index a8050a0..cb28779 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +# run production locally + version: '3.8' services: @@ -9,6 +11,9 @@ services: dockerfile: ./docker/Dockerfile args: ARG_SITE_URL: 'http://localhost:8080' + # make separate script with localhost enabled + ARG_PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js' + # platform: linux/arm64 platform: linux/amd64 restart: unless-stopped diff --git a/docker/Dockerfile b/docker/Dockerfile index 5469cb9..0c4064d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ RUN yarn install --frozen-lockfile # override sharp 0.32.6 with 0.33.3, fails without this RUN yarn remove sharp -RUN yarn add --arch=arm64 --platform=linux --libc=musl --ignore-engines sharp@0.33.4 +RUN yarn add --ignore-engines sharp@0.33.4 COPY . . diff --git a/docs/working-notes/my-old-code/Dockerfile b/docs/working-notes/my-old-code/Dockerfile new file mode 100644 index 0000000..d2c8861 --- /dev/null +++ b/docs/working-notes/my-old-code/Dockerfile @@ -0,0 +1,41 @@ +# Dockerfile from Astro docs + +# alpine is fine +# node:22.1.0-bookworm, node:20.13.1-slim, node:20.13.1-alpine +ARG NODE_IMAGE=node:20.13.1-alpine + +FROM ${NODE_IMAGE} AS base +WORKDIR /app + +# for alpine +RUN apk add --no-cache git + +FROM base AS build +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +# override sharp 0.32.6 with 0.33.3, fails without this +RUN yarn remove sharp +# RUN yarn add --arch=arm64 --platform=linux --libc=musl --ignore-engines sharp@0.33.4 +RUN yarn add --ignore-engines sharp@0.33.4 + +COPY . . + +# build time only env var +ARG ARG_SITE_URL +ENV SITE_URL=$ARG_SITE_URL +RUN echo "SITE_URL=$SITE_URL" + +ARG ARG_PLAUSIBLE_SCRIPT_URL +ENV PLAUSIBLE_SCRIPT_URL=$ARG_PLAUSIBLE_SCRIPT_URL +RUN echo "PLAUSIBLE_SCRIPT_URL=$PLAUSIBLE_SCRIPT_URL" + +RUN yarn build + +FROM nginx:stable-alpine3.17-slim AS runtime +COPY ./docker/nginx.conf /etc/nginx/nginx.conf + +# sufficient for SSG +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 8080 + diff --git a/package.json b/package.json index 1f7f6e6..0cf4b59 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "deploy:docker:local": "bash scripts/deploy-docker.sh lxc11 '~/traefik-proxy/apps/nmc-docker' nemanjamitic/nemanjam.github.io", "docker:build:push:arm": "docker buildx build -f ./docker/Dockerfile -t nemanjamitic/nemanjam.github.io --build-arg ARG_SITE_URL='https://nmc-docker.arm1.nemanjamitic.com' ARG_PLAUSIBLE_SCRIPT_URL='https://plausible.arm1.nemanjamitic.com/js/script.js' --platform linux/arm64 --push .", "docker:build:push:x86": "docker buildx build -f ./docker/Dockerfile -t nemanjamitic/nemanjam.github.io --build-arg ARG_SITE_URL='https://nmc-docker.local.nemanjamitic.com' ARG_PLAUSIBLE_SCRIPT_URL='https://plausible.arm1.nemanjamitic.com/js/script.js' --platform linux/amd64 --push .", - "docker:push": "docker push nemanjamitic/nemanjam.github.io" + "docker:push": "docker push nemanjamitic/nemanjam.github.io", + "dc:up": "docker compose up --build --force-recreate -d" }, "dependencies": { "@astrojs/mdx": "^3.1.3", diff --git a/src/pages/about.mdx b/src/pages/about.mdx index 0e486ef..3ec1ff6 100644 --- a/src/pages/about.mdx +++ b/src/pages/about.mdx @@ -12,7 +12,7 @@ import Link from '../components/Link.astro'; import Electronics1Image from '../assets/images/all-images/electronics1.jpg'; -export const { SITE_URL, AUTHOR_GITHUB, AUTHOR_LINKEDIN, AUTHOR_TWITTER, AUTHOR_YOUTUBE, REPO_URL } = CONFIG_CLIENT; +export const { AUTHOR_GITHUB, AUTHOR_LINKEDIN, AUTHOR_TWITTER, AUTHOR_YOUTUBE } = CONFIG_CLIENT; # About