diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..713d500 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules/ +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9f512ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# Use this image as the platform to build the app +FROM node:20 AS build + +# The WORKDIR instruction sets the working directory for everything that will happen next +WORKDIR /app + +# Install packages +RUN yarn global add pnpm + +ARG CLIENT_ID +ARG CLIENT_SECRET +ARG SESH_SECRET + +ENV CLIENT_ID=${CLIENT_ID} +ENV CLIENT_SECRET=${CLIENT_SECRET} +ENV SESH_SECRET=${SESH_SECRET} + +COPY package.json . +RUN pnpm i + +COPY . . + +# Build SvelteKit app +RUN pnpm build + +FROM node:20 + +WORKDIR /app + +COPY --from=build /app/build /app/build +COPY --from=build /app/package.json /app/package.json + +RUN npm install --omit=dev --legacy-peer-deps + +# This is the command that will be run inside the image when you tell Docker to start the container +CMD ["node", "build/index.js"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..831ce95 --- /dev/null +++ b/compose.yml @@ -0,0 +1,15 @@ +--- +name: 'stuff.kasterpalu' +services: + web: + container_name: 'stuff.kasterpalu-web' + build: + context: . + args: + ENV CLIENT_ID: $CLIENT_ID + ENV CLIENT_SECRET: $CLIENT_SECRET + ENV SESH_SECRET: $SESH_SECRET + env_file: .env + restart: unless-stopped + ports: + - 9005:3000 diff --git a/package.json b/package.json index 8e2fe7e..1945a22 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "minigames", + "name": "stuff.kasterpalu", "private": true, "version": "0.0.1", "type": "module",