Skip to content

Commit ac40a26

Browse files
authored
Optimize docker process (sqlpad#1170)
* Don't run tests, lint during docker build * Update docker-ci-tags.yml * Update docker-ci-latest.yml
1 parent 42fdd05 commit ac40a26

3 files changed

Lines changed: 15 additions & 30 deletions

File tree

.github/workflows/docker-ci-latest.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Set up QEMU
13-
uses: docker/setup-qemu-action@v1
13+
uses: docker/setup-qemu-action@v2
1414
- name: Set up Docker Buildx
15-
uses: docker/setup-buildx-action@v1
16-
- name: Login to DockerHub
17-
uses: docker/login-action@v1
15+
uses: docker/setup-buildx-action@v2
16+
- name: Login to Docker Hub
17+
uses: docker/login-action@v2
1818
with:
1919
username: ${{ secrets.DOCKERHUB_USERNAME }}
2020
password: ${{ secrets.DOCKERHUB_TOKEN }}
2121
- name: Build and push
2222
id: docker_build
23-
uses: docker/build-push-action@v2
23+
uses: docker/build-push-action@v3
2424
with:
2525
push: true
2626
platforms: linux/amd64,linux/arm64
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# https://github.com/docker/metadata-action
2-
# https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md
2+
# https://docs.docker.com/build/ci/github-actions/examples/#manage-tags-and-labels
33
name: docker-ci-tags
44

55
on:
66
push:
77
branches:
88
- 'master'
99
tags:
10-
- 'v*'
10+
- 'v*.*.*'
1111
pull_request:
1212
branches:
1313
- 'master'
@@ -17,10 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121
- name: Docker meta
2222
id: meta
23-
uses: docker/metadata-action@v3
23+
uses: docker/metadata-action@v4
2424
with:
2525
# list of Docker images to use as base name for tags
2626
images: |
@@ -33,20 +33,19 @@ jobs:
3333
type=semver,pattern={{major}}.{{minor}}
3434
type=semver,pattern={{major}}
3535
- name: Set up QEMU
36-
uses: docker/setup-qemu-action@v1
36+
uses: docker/setup-qemu-action@v2
3737
- name: Set up Docker Buildx
38-
uses: docker/setup-buildx-action@v1
39-
- name: Login to DockerHub
38+
uses: docker/setup-buildx-action@v2
39+
- name: Login to Docker Hub
4040
if: github.event_name != 'pull_request'
41-
uses: docker/login-action@v1
41+
uses: docker/login-action@v2
4242
with:
4343
username: ${{ secrets.DOCKERHUB_USERNAME }}
4444
password: ${{ secrets.DOCKERHUB_TOKEN }}
4545
- name: Build and push
46-
uses: docker/build-push-action@v2
46+
uses: docker/build-push-action@v3
4747
with:
4848
context: .
49-
platforms: linux/amd64,linux/arm64
5049
push: ${{ github.event_name != 'pull_request' }}
5150
tags: ${{ steps.meta.outputs.tags }}
5251
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN yarn
3535
WORKDIR /sqlpad/client
3636
RUN yarn
3737
WORKDIR /sqlpad/server
38-
RUN yarn
38+
RUN yarn --production
3939
WORKDIR /sqlpad
4040

4141
# Copy rest of the project into docker
@@ -47,20 +47,6 @@ RUN npm run build --prefix client && \
4747
mkdir server/public && \
4848
cp -r client/build/* server/public
4949

50-
# Build test db used for dev, debugging and running tests
51-
RUN node server/generate-test-db-fixture.js
52-
53-
# Run tests and linting to validate build
54-
ENV SKIP_INTEGRATION true
55-
RUN npm run test --prefix server
56-
RUN npm run lint
57-
58-
# Remove any dev dependencies from server
59-
# We don't care about root or client directories
60-
# as they are not going to be copied to next stage
61-
WORKDIR /sqlpad/server
62-
RUN npm prune --production
63-
6450
# Start another stage with a fresh node
6551
# Copy the server directory that has all the necessary node modules + front end build
6652
FROM node:16-bullseye-slim as bundle

0 commit comments

Comments
 (0)