-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Janky hotfix image rollback for #390 until I have more time"
This reverts commit b37120b.
- Loading branch information
Showing
1 changed file
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,86 @@ | ||
FROM ghcr.io/claabs/epicgames-freegames-node:54c98a7c5e5d6b04d2be9f336a319be1b24c876d@sha256:c0b54f0eaad8b5419594a2f29c0fc5d2402e580be99deafe0a66a47a3fcfc030 as deploy | ||
######## | ||
# BASE | ||
######## | ||
FROM node:18-alpine3.19 as base | ||
|
||
LABEL org.opencontainers.image.description="Automatically redeem free games promotions on the Epic Games store (hotfix)" | ||
ENV DISTRO=alpine | ||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 | ||
|
||
WORKDIR /usr/app | ||
|
||
######## | ||
# DEPS | ||
######## | ||
FROM base as deps | ||
|
||
# Go to https://hub.docker.com/_/node/ and note the latest stable Alpine version available (e.g. alpine3.19). | ||
# Go to https://pkgs.alpinelinux.org/package/v3.19/community/x86_64/chromium (replace with the latest Alpine version) | ||
# and note the Chromium version available. Then go to https://pptr.dev/chromium-support | ||
# and find the latest version that supports that Chromium version, and update it in the package.json. | ||
RUN apk add --no-cache \ | ||
'chromium=~124' \ | ||
ca-certificates \ | ||
ttf-freefont \ | ||
# App dependencies | ||
jq \ | ||
tzdata \ | ||
tini | ||
|
||
######## | ||
# BUILD | ||
######## | ||
FROM base as build | ||
|
||
# Copy all source files | ||
COPY package*.json tsconfig.json ./ | ||
|
||
# Add dev deps | ||
RUN npm ci | ||
|
||
# Copy source code | ||
COPY src src | ||
|
||
RUN npm run build | ||
|
||
######## | ||
# DEPLOY | ||
######## | ||
FROM deps as deploy | ||
|
||
# Copy package.json for version number | ||
COPY package*.json ./ | ||
|
||
RUN npm ci --omit=dev | ||
|
||
# Steal compiled code from build image | ||
COPY --from=build /usr/app/dist ./dist | ||
|
||
COPY entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
# backwards compat (from https://success.docker.com/article/use-a-script-to-initialize-stateful-container-data) | ||
RUN ln -s /usr/local/bin/docker-entrypoint.sh / | ||
|
||
ARG COMMIT_SHA="" \ | ||
BRANCH="" | ||
|
||
# Put COMMIT_SHA in a file, since Docker managers like Portainer will not use updated ENVs | ||
RUN echo $COMMIT_SHA > commit-sha.txt | ||
|
||
LABEL org.opencontainers.image.title="epicgames-freegames-node" \ | ||
org.opencontainers.image.url="https://github.com/claabs/epicgames-freegames-node" \ | ||
org.opencontainers.image.description="Automatically redeem free games promotions on the Epic Games store" \ | ||
org.opencontainers.image.name="epicgames-freegames-node" \ | ||
org.opencontainers.image.revision=${COMMIT_SHA} \ | ||
org.opencontainers.image.ref.name=${BRANCH} \ | ||
org.opencontainers.image.base.name="node:18-alpine3.19" \ | ||
org.opencontainers.image.version="latest" | ||
|
||
ENV NODE_ENV=production \ | ||
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \ | ||
COMMIT_SHA=${COMMIT_SHA} \ | ||
BRANCH=${BRANCH} | ||
|
||
EXPOSE 3000 | ||
|
||
VOLUME [ "/usr/app/config" ] | ||
|
||
ENTRYPOINT ["tini", "--", "docker-entrypoint.sh"] |