-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (42 loc) · 1.77 KB
/
Dockerfile
File metadata and controls
54 lines (42 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# The base image is plain node (which is amd64, e.g. AMD/Intel), but the
# base platform can be overridden with the NODE_PLATFORM build argument.
# Check out https://github.com/docker-library/official-images#architectures-other-than-amd64
#
# We do this in the `npm` script `build:docker`, for example, to get an M1-optimized image.
#
ARG NODE_PLATFORM=node
FROM $NODE_PLATFORM:16.13.2-alpine3.15
# Adds python3 so we can run node-memwatch in production and staging
RUN apk --no-cache add --virtual .builds-deps build-base python3=3.9.17-r0 --repository=htts://dl-cdn.alpinelinux.org/alpine/v3.15/main
# Ensure the entry point scripts are visible at runtime
ENV PATH="/scripts:${PATH}"
# /app contains all code/copied resources
# /app/build is where the built JS goes
# /scripts contains the entrypoint run scripts
WORKDIR /app
# Setup and install dependencies
ARG NPM_TASKFORCESH_TOKEN
COPY .npmrc .npmrc
COPY package*.json ./
RUN npm install && npm install -g typescript
# Copy the rest of the code to the working directory
COPY . .
RUN mkdir -p build
RUN npm run build
# Install ejson; this is used to decrypt environment runtime secrets in src/config/
RUN apk --no-cache add curl \
&& curl -sSL -o ejson https://github.com/Shopify/ejson/releases/download/v1.3.0/linux-amd64 \
&& chmod +x ejson \
&& ln -s $(pwd)/ejson /usr/bin/ejson \
&& mkdir ./ejson-keys
COPY scripts/docker/app /scripts
RUN chmod +x /scripts/*
# If available, use the build argument GIT_SHA to label the image; we use this
# for image versioning. A source commit is easier than a curated semver number,
# and provides a link back to the actual source tree which built the image).
ARG GIT_SHA=""
RUN echo $GIT_SHA > ./.git_sha
LABEL com.usecodex.git_sha=$GIT_SHA
EXPOSE 3000
ENTRYPOINT sh -c "entrypoint.sh"