forked from FromDoppler/doppler-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.RELEASES
More file actions
47 lines (40 loc) · 1.33 KB
/
Dockerfile.RELEASES
File metadata and controls
47 lines (40 loc) · 1.33 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
## Build layer
# When update node ---> remember to update all .sh files
FROM node:15.14.0 as verify
WORKDIR /app
COPY package.json yarn.lock ./
# Download dependencies
RUN yarn
# Copy source files
COPY . .
# Run tests and verify other requirements
RUN yarn verify
# Build project
FROM verify as build
ARG environment
RUN yarn build:$environment
# Build project
FROM verify as build_cdn
ENV REACT_APP_ROUTER=hash
ENV PUBLIC_URL="."
ARG environment
RUN yarn build:$environment
## Publish into new CDN using SFTP
## Using a third party image here, with specific digest (f7f7607...) to avoid unwanted changes
FROM ttionya/openssh-client@sha256:f7f7607d56f09a7c42e246e9c256ff51cf2f0802e3b2d88da6537bea516fe142
COPY --from=build_cdn /app/build /source
ARG environment
ARG pkgVersion
ARG CDN_SFTP_PORT
ARG CDN_SFTP_USERNAME
ARG CDN_SFTP_HOSTNAME
ARG CDN_SFTP_BASE
ARG SSH_PRIVATE_KEY
ARG SSH_KNOWN_HOSTS
RUN mkdir /root/.ssh/ &&\
echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa &&\
chmod 600 /root/.ssh/id_rsa &&\
echo "${SSH_KNOWN_HOSTS}" > /root/.ssh/known_hosts &&\
chmod 600 /root/.ssh/known_hosts
RUN scp -P "${CDN_SFTP_PORT}" -r /source "${CDN_SFTP_USERNAME}@${CDN_SFTP_HOSTNAME}:/${CDN_SFTP_BASE}/doppler-webapp/${environment}-${pkgVersion}"
RUN echo "Files published on http://cdn.fromdoppler.com/doppler-webapp/${environment}-${pkgVersion}"