Giter Club home page Giter Club logo

Comments (6)

NoamDev avatar NoamDev commented on May 30, 2024 2

Yay! I changed it to sha256sum -c to make the check automatic.

For future viewers, make sure to reset to the commit id from which the build was created.
In the case of 0.0.5:
$ git reset --hard d0782dad2406005acdda4a0e96b30eab85234ac5

My updated dockerfile:

FROM alpine/git as release

RUN git clone -b v0.0.5 https://github.com/satackey/action-docker-layer-caching /app
WORKDIR /app
RUN sha256sum dist/ttsc-dist/main.js/index.js dist/ttsc-dist/post.js/index.js > SHA256SUMS 


FROM node:12.16.2-slim

# Install latest yarn
RUN set -eux \
    && apt-get update \
    && apt-get install -y curl \
    && curl --compressed -o- -L https://yarnpkg.com/install.sh | bash \
    && apt-get remove -y curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install node_modules from package.json and yarn.lock
WORKDIR /app/frontend
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY post.ts main.ts tsconfig.json ./
COPY src src/
RUN npx ttsc --outDir ttsc-dist
RUN npx ncc build -o dist/ttsc-dist/main.js ttsc-dist/main.js
RUN npx ncc build -o dist/ttsc-dist/post.js ttsc-dist/post.js

COPY --from=release /app/SHA256SUMS .
RUN sha256sum -c SHA256SUMS

from action-docker-layer-caching.

NoamDev avatar NoamDev commented on May 30, 2024 1

Hmm, it is part of the cause, I created a Dockerfile so that I'd be able to control any tiny part of it (based on the Dockerfile in one of your repos :)
it still does not produce identical files to the ones in master-release..

clone master, create the dockerfile below and build it. The result should be in /app/frontend/dist

FROM node:12.16.2-slim

# Install latest yarn
RUN set -eux \
    && apt-get update \
    && apt-get install -y curl \
    && curl --compressed -o- -L https://yarnpkg.com/install.sh | bash \
    && apt-get remove -y curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install node_modules from package.json and yarn.lock
WORKDIR /app/frontend
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY post.ts main.ts tsconfig.json ./
COPY src src/
RUN ls
RUN npx ttsc 
RUN npx ncc build -o dist/main.js ts-dist/main.js
RUN npx ncc build -o dist/post.js ts-dist/post.js

from action-docker-layer-caching.

NoamDev avatar NoamDev commented on May 30, 2024 1

@satackey Thanks! Would you like to include this somewhere official?
For future paranoids 😜

from action-docker-layer-caching.

satackey avatar satackey commented on May 30, 2024

I'm using ttypescript to use custom transformer, which is required by typescript-is that enables run-time type guard.

However, ncc doesn't support custom transformers, so you have to use ttsc (the ttypescript version of the tsc transform command) to transpile from TypeScript to JavaScript and then use ncc to get the same bundle file.

from action-docker-layer-caching.

NoamDev avatar NoamDev commented on May 30, 2024

Maybe The ttypescript and @zeit/ncc should different than the ones in the yarn-lock?

from action-docker-layer-caching.

satackey avatar satackey commented on May 30, 2024

With ncc, I found that the input file name affects the results.
So it seems that the --outDir ttsc-dist needs to be added to ttsc in order to reproduce the build.

FROM alpine/git

RUN git clone -b v0.0.5 https://github.com/satackey/action-docker-layer-caching /app
WORKDIR /app
RUN sha256sum dist/ttsc-dist/main.js/index.js dist/ttsc-dist/post.js/index.js


FROM node:12.16.2-slim

# Install latest yarn
RUN set -eux \
    && apt-get update \
    && apt-get install -y curl \
    && curl --compressed -o- -L https://yarnpkg.com/install.sh | bash \
    && apt-get remove -y curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install node_modules from package.json and yarn.lock
WORKDIR /app/frontend
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY post.ts main.ts tsconfig.json ./
COPY src src/
RUN ls
RUN npx ttsc --outDir ttsc-dist
RUN npx ncc build -o dist/main.js ttsc-dist/main.js
RUN npx ncc build -o dist/post.js ttsc-dist/post.js

RUN sha256sum dist/main.js/index.js dist/post.js/index.js

Now both of the hashes will be the following values and I think you can reproduce the build :)

0f2543e89d55839e1f529306793bf5c299bfc362a483ae3b99ab74eda23dd041  dist/main.js/index.js
1b7e9e552eaf7658117f5408d40355bb67a9feaf11d7bcadb5ccdcf0f44392ad  dist/post.js/index.js

from action-docker-layer-caching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.